PreviousUser's Guide (v10) Next

Table Editor Tasks

Chapter contents

This section explains the tasks that you perform with Table Editor. The tasks are divided into the following categories:

Category
Description
Orient you to the overall use of Table Editor
Apply to using the Columns page
Apply to using the Indexes page
Apply to using the Statistic page
Apply to using the SQL View page


Note
You cannot save the changes to the structure of a table if any queries in SQL Editor are holding the table "open." Close the SQL Editor holding open the table then save the changes.

General Tasks

General tasks apply to the overall use of the tool.

Getting Started

Data

Columns Tasks

Column tasks apply to the Columns page.

Indexes Tasks

Index tasks apply to the Indexes page.

Foreign Keys Tasks

Foreign keys tasks apply to the Foreign Keys page.

SQL View Tasks

SQL view tasks apply to the SQL View page.

General Tasks

To start Table Editor for a new table

  1. Start PCC if it is not already running. (See Starting PCC on Windows .)
  2. Expand the Engines and Databases nodes in Pervasive PSQL Explorer.
  3. Right-click on the database to which you want to add the new table.
  4. Click New 4 Table and type the name for new table.

Tip
For a list of database object lengths and invalid characters, see Identifier Restrictions by Identifier Type in Advanced Operations Guide.
  1. Click Finish.

To start Table Editor for an existing table

  1. Start PCC if it is not already running. (See Starting PCC on Windows .)
  2. Expand the Engines and Databases nodes in Pervasive PSQL Explorer.
  3. Right-click on the table that you want to modify then click Edit.

To work with columns

  1. Perform the steps for To start Table Editor for an existing table or To start Table Editor for a new table.
  2. Click the Columns page tab.

To work with indexes

  1. Perform the steps for To start Table Editor for an existing table or To start Table Editor for a new table.
  2. Click the Indexes page tab.

To work with foreign keys

  1. Perform the steps for To start Table Editor for an existing table or To start Table Editor for a new table.
  2. Click the Foreign Keys page tab.

To view SQL statements applicable to the table

  1. Perform the steps for To start Table Editor for an existing table or To start Table Editor for a new table.
  2. Click the SQL View page tab.

To view table data

  1. If the Grid window view is not displayed, click Window 4 Show View 4 Grid.
  2. Perform the steps for To start Table Editor for an existing table or To start Table Editor for a new table.
  3. By default, the Grid shows all of the data for the table (the result of a SELECT * FROM table statement).
  4. If the Grid is empty but the table contains data, right-click on any row in the Grid then click Refresh.

    Note that the Grid allows you to directly change database data by changing the values in the grid cells. See Grid Tasks .

To identify tables with changes that have not been saved

  1. Observe the Table Editor tab at the top. The tab contains the name of the table being created or edited. An asterisk (*) precedes the name if any modifications have occurred to columns, indexes, or foreign keys but not yet saved.

To save changes for the table being edited

Note that you cannot undo or redo changes to a table once the table has been saved.

  1. Click File 4 Save or click .

  2. Note
    You cannot save the changes to the structure of a table if the table is open in SQL Editor. Close the SQL Editor referencing the table then save the changes.

To save changes for all tables being edited

Note that you cannot undo or redo changes to tables once the tables have been saved.

  1. Click File 4 Save All.

  2. Note
    You cannot save the changes to the structure of a table if the table is open in SQL Editor. Close the SQL Editors referencing the tables then save the changes.

To undo changes or to redo changes

  1. In the toolbar, click to undo an action; click to redo an action.
  2. If multiple actions have occurred since the last save, you can repeatedly click the undo or redo toolbar buttons. When no more actions are available for undo or redo, the toolbar button becomes disabled.

    Note that you cannot undo or redo changes to a table once the table has been saved.

Columns Tasks

To insert a column between existing columns

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Right-click on an existing column row above which you want to insert a new column.
  3. Click Insert Column.
  4. The new column appears above the existing column row. The default name of the inserted column is "columnn," where "n" is a number that automatically increments by one. (The first column you insert is column0, the second column1 and so forth.)


Tip
You can also insert a column by clicking on an existing column row, then pressing Ctrl+Insert or clicking . Repeating either action inserts a series of columns in succession.
  1. Click File 4 Save or before changing pages within Table Editor.

To insert a column at the end

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Right-click anywhere on the empty column row below the last existing column row, then click Add Column.
  3. or

    Click the "Column Name" cell on the empty column row below the last existing column row and start typing a name for the column.

    The default name of the inserted column is "columnn," where "n" is a number that automatically increments by one. (The first column you insert is column0, the second column1 and so forth.)


Tip
You can also insert a column at the end by clicking or pressing Ctrl+Insert.

Repeating either action inserts a series of columns in succession. The insert action automatically adds the new column to the end.
  1. Click File 4 Save or before changing pages within Table Editor.

To select a column or multiple columns

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Click (the column selection icon on the far left of the column row) for the desired column.
  3. To select multiple columns, press and hold Shift or Ctrl then click for the desired additional columns.

To delete a column

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Right-click anywhere on the desired column row.
  3. Click Drop Column.

Tip
You can also delete a column by clicking on an existing column row, then pressing Ctrl+Delete or clicking .

You can also delete multiple columns by selecting multiple columns rows. See To select a column or multiple columns .

  1. Click File 4 Save or before changing pages within Table Editor.

To specify a column name

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Click in the Column Name cell for the desired column.
  3. Delete the existing column name.
  4. Type the name you want.

Tip
For a list of database object lengths and invalid characters, see Identifier Restrictions by Identifier Type in Advanced Operations Guide.

Also, as a general rule, avoid using reserved words for column names. See Reserved Words in SQL Engine Reference. See also Versions of Metadata in SQL Engine Reference.

  1. Click File 4 Save or before changing pages within Table Editor.

To set a column data type

The data in your database is converted if you change a column data type. For a listing of data types, see Pervasive PSQL Supported Data Types in SQL Engine Reference.

Changing a column data type sets the defaults for that type on the following: size, scale, precision, default, and collate.

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Click in the Type cell for the desired column.
  3. Open the list for data types (click ).
  4. Scroll to the data type you want. (You may also type the first letter of the desired data type to scroll. Repeatedly typing the first letter scrolls to each data type that begins with that letter.)
  5. Click the data type you want.
  6. Click File 4 Save or before changing pages within Table Editor.

To set a column size

Data in your database is truncated if you change the column to a smaller size for the following data types:

To set column precision

Precision specifies the number of significant digits for floating point values.

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Click in the Precision cell for the desired column.
  3. You can set precision only for applicable data types, such as DECIMAL. If precision is not applicable, the grid cell is shaded and you will be unable to edit the Precision.

  4. Delete the existing value.
  5. Type the precision value you want.
  6. Click File 4 Save or before changing pages within Table Editor.

To set a column scale

Scale specifies the number of significant digits that are to the right of the decimal point for floating point values.

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Click in the Scale cell for the desired column.
  3. You can set a scale value only for applicable data types, such as NUMERIC. If scale is not applicable, the grid cell is shaded and you will be unable to edit the Scale.

  4. Delete the existing value.
  5. Type the scale value you want.
  6. Click File 4 Save or before changing pages within Table Editor.

To set a column to allow or disallow nulls

For additional information about nulls, see Rebuild Utility Concepts in Advanced Operations Guide, INSERT in SQL Engine Reference, and Null Value in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Click the option box in the Null cell for the desired column.
  3. You can allow nulls only for applicable data types. A shaded square indicates that null values do not apply to the data type.

    Option State
    Meaning

    Nulls specified

    Nulls allowed but not specified

    Nulls do not apply

    Also see Null Values .

  4. Click File 4 Save or before changing pages within Table Editor.

To set case sensitivity for a column

Case sensitivity does not apply if the key uses an alternate collating sequence (ACS). You cannot specify case sensitivity and use an ACS.

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Click the option box in the Case cell for the desired column.
  3. You can set a collating sequence only for applicable data types. A shaded square indicates that case sensitivity does not apply to the data type.

    Option State
    Meaning

    Case insensitive

    Case sensitive

    Case does not apply

    By default, Pervasive PSQL is case sensitive when sorting string keys. Uppercase letters are sorted before lowercase letters. If you specify case insensitive, values are sorted without distinguishing case.

  4. Click File 4 Save or before changing pages within Table Editor.

To set a column collating sequence

For additional information about collating sequences, see Manipulating Btrieve Data Files with Maintenance in Advanced Operations Guide and Alternate Collating Sequences in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).

If you use an alternate collating sequence (ACS), you cannot specify case sensitivity. Case sensitivity does not apply if the key uses an ACS.

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Click in the Collate cell for the desired column.
  3. You can set an alternating collating sequence (ACS) only for applicable data types. If collating sequence is not applicable, the grid cell is shaded and you will be unable to edit the Collate cell.

  4. Delete the existing value, if present.
  5. Type the path and ACS file name you want.
  6. Pervasive PSQL supplies an ACS file, upper.alt, in the Samples folder. (See Where are the Pervasive PSQL v10 files installed? in Getting Started With Pervasive PSQL.) To use this file, you would type file_path\PSQL\samples\upper.alt.

    Upper.alt treats upper and lower case letters the same for sorting. For example, if a database has values abc, ABC, DEF, and Def, inserted in that order, the sorting with upper.alt returns as abc, ABC, DEF, and Def. (The values abc and ABC, and the values DEF and Def are considered duplicates and are returned in the order in which they were inserted.) Normal ASCII sorting sequences upper case letters before lower case, such that the sorting would return as ABC, DEF, Def, abc.

  7. Click File 4 Save or before changing pages within Table Editor.

To set a column default

The default value is used if you perform an SQL INSERT for a row but do not provide a value for the column.

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Click in the Default cell for the desired column.
  3. You can set a default only for applicable data types. If a default is not applicable, the grid cell is shaded and you will be unable to edit the Default.

  4. Delete the existing value, if present.
  5. Type the default value you want.
  6. The column default can be a scalar function for certain data types:

    Data Type
    Scalar Function1
    Date
    • now()
    • curdate()
    See also NOW ( ) and CURDATE ( ) , both in SQL Engine Reference.
    Time
    • now()
    • curtime()
    See also NOW ( ) and CURTIME ( ) in SQL Engine Reference.
    Timestamp
    • now()
    See also NOW ( ) in SQL Engine Reference.
    1 The names are case insensitive. NOW() and now() are equivalent. The parentheses are required. That is, NOW is invalid but NOW() is valid.

  7. Click File 4 Save or before changing pages within Table Editor.

To set or remove a column as a primary key

Note that you cannot set a primary key on a column that allows NULLs.

  1. Ensure that the "Columns" page of Table Editor is active. If required, perform the steps for To work with columns .
  2. Click (the column selection icon on the far left of the column row) for the desired column(s).
  3. To select multiple columns, press and hold Shift or Ctrl then click for the desired additional columns.

  4. Click (the primary key icon).
  5. If the column(s) is not a primary key, the action sets the column(s) as a primary key.

    If the column, or if any of the columns when multiple columns are selected, is already a primary key, the action removes the setting from all columns.

    For example, suppose that column 1 is a primary key and you want columns 1, 2, and 3 to be the primary key. You press and hold Ctrl then click columns 1, 2, and 3. When you click the primary key icon, it is removed from column 1 but not added to columns 2 and 3. If you click the primary key icon again, then columns 1, 2, and 3 are designated as primary keys.

  6. Click File 4 Save or before changing pages within Table Editor.

Index Tasks

To create an index

Only the database engine can add an index to an IDENTITY or SMALLIDENTITY column. However, you can include an IDENTITY or SMALLIDENTITY column as part of a multiple-segment index.

Table Editor permits you to include an IDENTITY or a SMALLIDENTITY column in the Indexes list if you have not saved the table. However, the DBMS returns an error when you attempt to save the table. After you delete the IDENTITY or SMALLIDENTITY column from the list, you may then save the table.

  1. Ensure that the "Indexes" page of Table Editor is active. If required, perform the steps for To work with indexes .
  2. Click Add.
  3. The New Index dialog displays.

  4. Type the name of the new index and click OK.

Tip
For a list of database object lengths and invalid characters, see Identifier Restrictions by Identifier Type in Advanced Operations Guide.

The new index appears in the Indexes list and the Index Segment Details display. Note that the first column is populated into the Columns list.


Note
New indexes are created by default as Normal.

  1. In the Columns list, select the Column to designate for the Index or Index Segment.

Caution
Indexes must have at least one Column designated. If you do not select a Column for the Index, the first column remains selected.

The default sort order is Ascending. If you need a descending sort order, select Descending from the Sort Order list for the Column you want changed.


Note
Some data types, such as LONGVARBINARY, cannot be used for an index. Columns with such data types are not valid choices.
  1. Continue selecting columns from the list until all the segments are added.
  2. Note that a column can be selected for an index only once. Once selected, the column is removed from the list of choices because the column has already been designated in the index.

  3. Click File 4 Save or before changing pages within Table Editor.
  4. See also Creating Indexes in Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).

To create a unique index

Only the database engine can add an index to an IDENTITY or SMALLIDENTITY column. However, you can include an IDENTITY or SMALLIDENTITY column as part of a multiple-segment index.

Table Editor permits you to include an IDENTITY or a SMALLIDENTITY column in the Indexes list if you have not saved the table. However, the DBMS returns an error when you attempt to save the table. After you delete the IDENTITY or SMALLIDENTITY column from the list, you may then save the table.

  1. Ensure that the "Indexes" page of Table Editor is active. If required, perform the steps for To work with indexes .
  2. Click Add.
  3. The New Index dialog displays.

  4. Type the name of the new index and click OK.

Tip
For a list of database object lengths and invalid characters, see Identifier Restrictions by Identifier Type in Advanced Operations Guide.

The new index appears in the Indexes list and the Index Segment Details display.


Note
New indexes are created by default as Normal.
  1. Select Unique in the Index Segment Details area to designate the index as unique.
  2. Selecting Unique disables duplicatibility, restricting duplicates.

    Note that the first column is populated into the Columns list.



  3. In the Columns list, select the Column to designate for the Index or Index Segment.

Caution
Indexes must have at least one Column designated. If you do not select a Column for the Index, the first column remains selected.

The default sort order is Ascending. If you need a descending sort order, select Descending from the Sort Order list for the Column you want changed.


Note
Some data types, such as LONGVARBINARY, cannot be used for an index. Columns with such data types are not valid choices.
  1. Continue selecting columns from the list until all the segments are added.
  2. Note that a column can be selected for an index only once. Once selected, the column is removed from the list of choices because the column has already been designated in the index.

  3. Click File 4 Save or before changing pages within Table Editor.
  4. See also Creating Indexes in Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).

To create a partial index

Only the database engine can add an index to an IDENTITY or SMALLIDENTITY column. However, you can include an IDENTITY or SMALLIDENTITY column as part of a multiple-segment index.

Table Editor permits you to include an IDENTITY or a SMALLIDENTITY column in the Indexes list if you have not saved the table. However, the DBMS returns an error when you attempt to save the table. After you delete the IDENTITY or SMALLIDENTITY column from the list, you may then save the table.

  1. Ensure that the "Indexes" page of Table Editor is active. If required, perform the steps for To work with indexes .
  2. Click Add.
  3. The New Index dialog displays.

  4. Type the name of the new index and click OK.

Tip
For a list of database object lengths and invalid characters, see Identifier Restrictions by Identifier Type in Advanced Operations Guide.

The new index appears in the Indexes list and the Index Segment Details display.


Note
New indexes are created by default as Normal.
  1. Select Partial in the Index Segment Details area to designate the index as partial.
  2. Note that the first column is populated into the Columns list.



  3. In the Columns list, select the Column to designate for the Index or Index Segment.

Caution
Indexes must have at least one Column designated. If you do not select a Column for the Index, the first column remains selected.

The default sort order is Ascending. If you need a descending sort order, select Descending from the Sort Order list for the Column you want changed.


Note
Partial Indexes are restricted to columns with a data type of CHAR or VARCHAR and that are designated as the only or last segment in an Index.
  1. Continue selecting columns from the list until all the segments are added.
  2. Note that a column can be selected for an index only once. Once selected, the column is removed from the list of choices because the column has already been designated in the index.

  3. Click File 4 Save or before changing pages within Table Editor.
  4. See also Creating Indexes in Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).

To modify an existing index

The database engine creates some indexes, such as IDENTITY column indexes and primary key indexes. These indexes are read-only and cannot be modified.

Table Editor permits you to include an IDENTITY or a SMALLIDENTITY column in the Indexes list if you have not saved the table. However, the DBMS returns an error when you attempt to save the table. After you delete the IDENTITY or SMALLIDENTITY column from the list, you may then save the table.

  1. Ensure that the "Indexes" page of Table Editor is active. If required, perform the steps for To work with indexes .
  2. Click the desired index in the Indexes list.
  3. The Index Segment Details displays.

  4. Modify the segment details as desired.
  5. Click File 4 Save or before changing pages within Table Editor.

To delete an index

The database engine creates some indexes, such as IDENTITY column indexes and primary key indexes. These indexes are read-only and cannot be deleted.

  1. Ensure that the "Indexes" page of Table Editor is active. If required, perform the steps for To work with indexes .
  2. Click the desired index in the Indexes list.
  3. With the Index you want to delete selected, click Delete in the Indexes list.


  4. Click Yes to confirm the deletion.
  5. Click File 4 Save or before changing pages within Table Editor.

To insert an index segment

For detailed information about segments, see Segmentation in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).

Only the database engine can add an index to an IDENTITY or a SMALLIDENTITY column. However, you can include an IDENTITY or a SMALLIDENTITY column as part of a multiple-segment index. See also AUTOINC in SQL Engine Reference.

  1. Ensure that the "Indexes" page of Table Editor is active. If required, perform the steps for To work with indexes .
  2. Click the desired index in the Indexes list.
  3. The Index Segment Details displays and lists the selected Index Segments.

  4. Click in the first empty Columns cell, then open the Columns list (click ).


  5. From the list, click the desired column for the segment.

  6. Note
    Some data types, such as LONGVARBINARY, cannot be used for an index. Columns with such data types are not valid choices.

    The default sort order is Ascending. If you need a descending sort order, select Descending from the Sort Order list for the Column you want changed.

  7. Continue selecting columns from the list until all the segments are added.
  8. Note that a column can be selected for an index only once. Once selected, the column is removed from the list of choices because the column has already been designated in the index.

  9. Click File 4 Save or before changing pages within Table Editor.

To modify an index segment

For detailed information about segments, see Segmentation in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).

Only the database engine can add an index to an IDENTITY or a SMALLIDENTITY column. However, you can include an IDENTITY or a SMALLIDENTITY column as part of a multiple-segment index. See also AUTOINC in SQL Engine Reference.

  1. Ensure that the "Indexes" page of Table Editor is active. If required, perform the steps for To work with indexes .
  2. Click the desired index in the Indexes list.
  3. The Index Segment Details displays.

  4. Click the desired segment in the Columns cell then open the list of columns (click ).


  5. From the Columns list, click the desired column designated as the index segment.

  6. Note
    Some data types, such as LONGVARBINARY, cannot be used for an index. Columns with such data types are not valid choices.

    The default sort order is Ascending. If you need a descending sort order, select Descending from the Sort Order list for the Column you want changed.

  7. Continue selecting columns from the list until you have completed all segment modifications.
  8. Note that a column can be selected for an index only once. Once selected, the column is removed from the list of choices because the column has already been designated in the index.

  9. Click File 4 Save or before changing pages within Table Editor.

To delete an index segment


Note
Each index requires a minimum of one segment. To delete an index that has only one segment, delete the index itself.
  1. Ensure that the "Indexes" page of Table Editor is active. If required, perform the steps for To work with indexes .
  2. Click the desired index in the Indexes list.
  3. The Index Segment Details displays, listing all the designated index segments.

  4. Click the desired index segment.
  5. With the index segment you want to delete selected, click Delete in the Index Segment Details Columns list.


  6. Click File 4 Save or before changing pages within Table Editor.

To arrange the order of index segments

  1. Ensure that the "Indexes" page of Table Editor is active. If required, perform the steps for To work with indexes .
  2. Click on the desired index in the Indexes list.
  3. The Index Segment Details displays.

  4. Click the index segment you want to reorder.
  5. Click Up to move the segment toward the top of the segment grouping, or Down to move the segment toward the bottom.
  6. Click File 4 Save or before changing pages within Table Editor.

To specify a sort order for an index

For detailed information about sort order, see Sort Order in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).

  1. Ensure that the "Indexes" page of Table Editor is active. If required, perform the steps for To work with indexes .
  2. Click on the desired index in the Indexes list.
  3. The Index Segment Details displays.

  4. Click in the Sort Columns cell then open the list of sort choices (click ).
  5. From the Sort Order list, click Ascending or Descending.
  6. The default sort order when an index segment is created is ascending.

  7. Click File 4 Save or before changing pages within Table Editor.

To allow duplicates in an index

For detailed information about duplicates, see Duplicatability in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).

  1. Ensure that the "Indexes" page of Table Editor is active. If required, perform the steps for To work with indexes .
  2. Click the desired index in the Indexes list.
  3. The Index Segment Details displays.

  4. Clear the Unique option in the Index Segment Details area by selecting one of the other options (Partial or Normal).

  5. Note
    By default, indexes are created as Normal, allowing duplicates.
  6. Click File 4 Save or before changing pages within Table Editor.

To specify index as modifiable

For detailed information about modifiability, see Modifiability in the Pervasive PSQL Programmer's Guide, which is part of the Pervasive PSQL Software Developer's Kit (SDK).

  1. Ensure that the "Indexes" page of Table Editor is active. If required, perform the steps for To work with indexes .
  2. Click the desired index in the Indexes list.
  3. The Index Segment Details displays.

  4. Click Allow Modifications option.


  5. A check mark in the box indicates that the index value can be modified. Lack of a check mark indicates that the index value cannot be modified.

    Option State
    Meaning

    Values can be modified

    Values cannot be modified

    Modifiable does not apply

    The default for all SQL data types is that the index column is modifiable.

  6. Click File 4 Save or before changing pages within Table Editor.

Foreign Keys Tasks

To add a foreign key

Note that at least one table in the database must have a primary key or you cannot add a foreign key.

  1. Ensure that the "Foreign Keys" page of Table Editor is active. If required, perform the steps for To work with foreign keys .
  2. Click Add.
  3. Type the name that you want for the new foreign key.

Tip
For a list of database object lengths and invalid characters, see Identifier Restrictions by Identifier Type in Advanced Operations Guide.
  1. Click OK.
  2. The new foreign key appears in the Foreign Keys list and the Foreign Keys Details display.



  3. Click for "Select Primary Table" to display the list of tables permissible as primary tables.


  4. Click the desired table in the list (only tables with a primary key appear in the list).
  5. The primary field(s) in the table appear in "Primary Table Fields" column.



  6. Match fields in the foreign table with fields in the primary table:
  7. Click the empty cell in the "Foreign Table Fields" column for the corresponding field in the "Primary Table Fields," then click to displays the list of permissible fields.




    Note
    The data type and size of the fields must match. The list of Foreign Table Fields contains only fields that are the same data type and size as the primary table field being matched.
  8. Click the desired field in the list.
  9. Repeat steps 7 and 8 to match each field listed in the "Primary Table Fields" column with a field in the "Foreign Table Fields" column.
  10. Click the desired referential integrity rule: Delete Restrict or Delete Cascade.
  11. Pervasive PSQL allows a circular delete cascade on a table that references itself. Because of this, use delete cascade with caution. See Delete Restrict and Delete Cascade , both in Advanced Operations Guide.

  12. Click File 4 Save or before changing pages within Table Editor.

To modify a foreign key

  1. Ensure that the "Foreign Keys" page of Table Editor is active. If required, perform the steps for To work with foreign keys .
  2. Click on the desired foreign key in the Foreign Keys list.
  3. The Foreign Keys Details displays.
  4. As desired, select the primary table, match foreign table fields to primary table fields, and set the referential integrity rule.
  5. See steps 5 through 10 in To add a foreign key .

  6. Click File 4 Save or before changing pages within Table Editor.

To delete a foreign key

  1. Ensure that the "Foreign Keys" page of Table Editor is active. If required, perform the steps for To work with foreign keys .
  2. Click on the desired foreign key in the Foreign Keys list.
  3. Click Delete.
  4. Click Yes to confirm the deletion.
  5. Click File 4 Save or before changing pages within Table Editor.

SQL View Tasks

To copy SQL statements

  1. Ensure that the "SQL View" page of Table Editor is active. If required, perform the steps for To view SQL statements applicable to the table .
  2. Position the cursor in the desired statement view: CREATE Statement or ALTER Statement.
  3. With the mouse, select the desired text. (Press and hold the right mouse button then "drag" across the desired lines.)

Tip
You can press Ctrl+A to select all of the text.
  1. Right-click then click Copy (or press Ctrl+C).

To maximize or restore view of SQL statements

  1. Ensure that the "SQL View" page of Table Editor is active. If required, perform the steps for To view SQL statements applicable to the table .
  2. For the desired statement view, CREATE Statement or ALTER Statement, click the icon in the upper right corner of the view:
    Icon
    Action

    Maximizes the statement view.

    Restores the statement view to its size prior to maximizing.


Chapter contents
Book contents

Prev topic: Table Editor GUI Visual Reference
Next topic: SQL Editor