
It is the value to assign to the column if left blank or NULL. If this parameter is omitted, the database assumes NULL as the default. The columns that you wish to create in the table.Įach column should be defined as NULL or NOT NULL. The name of the table that you wish to create. If specified, the CREATE TABLE statement will not raise an error if the tables already exists. This improves performance on the table, however, the data in this table will be lost if a crash occurs. If specified, the data in the table is not written to the write-ahead log. If either of these are specified, the table is a local temporary table. If either of these are specified, he table is a global temporary table. REFERENCES another_table_name (index_col_name. A constraint is an SQL object that helps define the set of valid values in the table in various ways.įull syntax for the PostgreSQL CREATE TABLE statement is:
#Postgresql create table update#
The optional constraint clauses specify constraints (tests) that new or updated rows must satisfy for an insert or update operation to succeed.Therefore, tables cannot have the same name as any existing data type in the same schema. CREATE TABLE also automatically creates a data type that represents the composite type corresponding to one row of the table.The name of the table must be distinct from the name of any other table, sequence, index, view, or foreign table in the same schema.

Temporary tables exist in a special schema, so a schema name cannot be given when creating a temporary table. Otherwise it is created in the current schema. ) then the table is created in the specified schema.


The table will be owned by the user issuing the command.
