Tables Wizard (PostgreSQL)

From DBArtisan
Jump to: navigation, search

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:

  1. Open a creation wizard for a table. For details, see Opening an Object Wizard.
  2. Use the following topics as a guide to setting properties and performing tasks as you pass through the wizard panels:
  3. Finally, use the Execute button to create the object.

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:

  1. 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.
  2. Provide a Name for the column.
  3. 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: