From: | "Daniel Westermann (DWE)" <daniel(dot)westermann(at)dbi-services(dot)com> |
---|---|
To: | "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org> |
Subject: | Be more clear what names can be used for tables with "CREATE TABLE"? |
Date: | 2021-10-30 11:08:15 |
Message-ID: | ZR0P278MB0920D0946509233459AF0DEFD2889@ZR0P278MB0920.CHEP278.PROD.OUTLOOK.COM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
HI all,
in the documentation for CREATE TABLE we have this sentence:
"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."
At least materialized views are missing:
postgres=# create materialized view t as select 1;
SELECT 1
postgres=# create table t ( a int );
ERROR: relation "t" already exists
postgres=# drop materialized view t;
DROP MATERIALIZED VIEW
Domains are also missing:
postgres=# create domain t as int;
CREATE DOMAIN
postgres=# create table t ( a int );
ERROR: type "t" already exists
HINT: A relation has an associated type of the same name, so you must use a name that doesn't conflict with any existing type.
postgres=# drop domain t;
DROP DOMAIN
... but that maybe is covered by the next paragraph?
"CREATE TABLE also automatically creates a data type that represents the composite type corresponding to one row of the table. Therefore, tables cannot have the same name as any existing data type in the same schema."
Regards
Daniel
From | Date | Subject | |
---|---|---|---|
Next Message | Jürgen Purtz | 2021-10-30 15:27:02 | Re: Be more clear what names can be used for tables with "CREATE TABLE"? |
Previous Message | Daniel Gustafsson | 2021-10-29 12:22:43 | Re: broken link to "SELinux guide" from sepgsql |