Tables Wizard (PostgreSQL)
Go Up to PostgreSQL Object Wizards
This wizard lets you build and submit a CREATE TABLE statement, creating a new table.
To create a new table using a wizard:
- Open a creation wizard for a table. For details, see Opening an Object Wizard.
- Use the following topics as a guide to setting properties and performing tasks as you pass through the wizard panels:
- Properties panel - for details, see Tables (PostgreSQL) - Properties.
- Ancestors panel - for details, see Tables (PostgreSQL) - Ancestors.
- Columns panel - for details, see Tables (PostgreSQL) - Columns.
- Constraints panel - for details, see Tables (PostgreSQL) - Constraints.
- Permissions panel - for details, see Setting Permissions or Privileges for an Object
- Comment panel - for details, see Adding a Comment to an Object.
- DDL View panel - for details, see Previewing the DDL Generated to Create the New Object.
- Finally, use the Execute button to create the object.
Contents
Tables (PostgreSQL) - Properties
When creating or editing a table, this tab/panel lets you work with the following settings:
Setting | Description |
---|---|
Owner, Schema, and Name |
Lets you provide ownership details and provide a name for the table. |
Tablespace |
Lets you select a CREATE TABLE... TABLESPACE parameter value, specifying the tablespace in which the new table will be created. |
With OIDS |
If selected, a WITH (OIDS=TRUE) parameter is added to the generated DDL, specifying that rows of the table will have object identifiers. Otherwise, a WITH (OIDS=FALSE) parameter is added to the generated DDL. |
Persistence |
Lets you change from the default form of CREATE TABLE statement by selecting either TEMPORARY (CREATE TEMPORARY TABLE) or UNLOGGED (CREATE UNLOGGED TABLE). |
Of Type |
Lets you select the value for an OF clause, designating this as a typed table. Any columns defined using the Ancestors or Columns tab are overwritten when a type is selected. |
On Commit |
Only available with a Persistence selection of TEMPORARY. Lets you change the ON COMMIT... parameter DDL generated between DROP (ON COMMIT DROP), PRESERVE ROWS (ON COMMIT PRESERVE ROWS), and DELETE ROWS (ON COMMIT DELETE ROWS). |
Fill Factor |
Lets you provide a FILLFACTOR parameter value, an integer expressing a percentage between 10 and 100, dictating the upper limit to which INSERTs can pack table pages. |
Table Autovacuum... settings |
Lets you enable or disable the autovacuum daemon as well as specify values for parameters used in autovacuum calculations (Threshold, Scale Factor, Analyze Threshold, Analyze Threshold, Cost Delay, Cost Limit, Freeze Min Age, Freeze Max Age, Freeze Table Age, Multixact Freeze Min Age, Multixact Freeze Max Age, and Multixact Freeze Table Age. |
Toast Table Autovacuum... settings |
Lets you enable or disable the autovacuum daemon for the table’s secondary toast table, as well as specify values for parameters used in autovacuum calculations (Threshold, Scale Factor, Cost Delay, Cost Limit, Freeze Min Age, Freeze Max Age, Freeze Table Age, Multixact Freeze Min Age, Multixact Freeze Max Age, and Multixact Freeze Table Age. |
Tables (PostgreSQL) - Ancestors
This tab/panel lets you add an INHERITS clause to the generated DDL, building a list of tables from which this table inherits columns. For each table to be added to the list, use the New button to enable a dropdown that lets you select a table. Use the Delete button to remove a selected table from the list.
Tables (PostgreSQL) - Columns
When creating or editing a table, this tab/panel lets you manage the columns for the table:
To add a column to the table:
- Use the Add Column dropdown to add a new column (Add Column) to the bottom of the column list or to insert a new column (Insert Column) above the currently selected column in the column list.
- Provide a Name for the column.
- Use the following table as a guide to providing additional property values, noting that availability of a property differs by data type and other property selections:
Setting | Description |
---|---|
Type |
Lets you select the datatype for the column. |
Allow Nulls |
If not selected, a NOT NULL argument is added to the column specification. |
Default |
Lets you provide a default value for the column. |
Comment |
Lets you append a COMMENT ON COLUMN statement to the generated table creation DDL. |
Statistics Target |
Lets you append an ALTER TABLE... ALTER COLUMN... SET STATISTICS statement to the generated table creation DDL, setting the per-column statistics-gathering target for ANALYZE operations. |
Storage Mode |
Lets you append an ALTER TABLE... ALTER COLUMN... SET STORAGE statement to the generated table creation DDL, with a storage specifier of EXTERNAL, EXTENDED, or MAIN. |
NDistinct Values and NDistinct Values Inherited |
Let you append ALTER TABLE... ALTER COLUMN... SET (n_distinct or n_distinct_inherited) statements to the generated table creation DDL. These override the number-of-distinct-values estimates made by ANALYZE operations for the table or its inherited children. |
To edit a column:
- Select the column from the list and edit property values as per the descriptions above.
To drop a column:
- Select the column from the list and click the Delete button.
To reorder the column list:
- Move a selected column up or down the list using the Move Item Up or Move Item Down buttons.
Tables (PostgreSQL) - Constraints
When creating or editing tables, this tab/panel lets you manage foreign key, primary key, unique key, exclusion constraints, and check constraints for the table:
- Select a constraint type and click Add to open a wizard that lets you add a new constraint of that type to the table.
- Select an existing constraint and click Edit to open a wizard that lets you add modify that constraint. The wizards used to add and modify constraints offer functionality identical to the editors and wizards used when creating those object types. For details, see the following topics:
- Check Constraints Wizard (PostgreSQL) and Check Constraints Editor (PostgreSQL)
- Foreign Keys Wizard (PostgreSQL) and Foreign Keys Editor (PostgreSQL)
- Roles Wizard (PostgreSQL) and Roles Editor (PostgreSQL)
- Exclusion Constraints, Primary Keys, and Unique Keys Wizards (PostgreSQL) and Exclusion Constraints, Primary Keys, or Unique Keys Editors (PostgreSQL)
- Select a constraint and click Drop to drop a constraint from the table.