BUG #5630: CREATE INDEX does not use schema search path
BUG #5630: CREATE INDEX does not use schema search path
От:
"tbz" <tbb@vollbio.de>
Дата:
The following bug has been logged online: Bug reference: 5630 Logged by: tbz Email address: tbb@vollbio.de PostgreSQL version: 8.3.11 Operating system: Debian Sqeeze Description: CREATE INDEX does not use schema search path Details: 1. Create a new schema like a login user 2. Write a script, that creates a new table pg_user (system table!) and seperately an index on it 3. Run the script The table is created in the "user" schema. The creating of the index results in [Error Code: 0, SQL State: 42501] FEHLER: Berechtigung nur für Eigentümer der Relation pg_user I have to use the full qualified table name while creating the index. pg_user seems to be a system table, but I think this error will also be occured, when there is an table with an identical name in schema public. Bye Thomas ---------- Snip ---------- CREATE TABLE pg_user ( login_name VARCHAR(50) NOT NULL ); CREATE UNIQUE INDEX ak1_login_name ON pg_user(login_name); ---------- Snap ----------
Re: BUG #5630: CREATE INDEX does not use schema search path
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"tbz" writes: > CREATE TABLE pg_user ( > login_name VARCHAR(50) NOT NULL > ); > CREATE UNIQUE INDEX ak1_login_name ON pg_user(login_name); > [fails] This is expected, given the default search_path settings in which pg_catalog is implicitly at the front of the path. When you create pg_user, it's created in whichever schema is the creation target schema (ie, the first schema listed explicitly in search_path, perhaps "public"). However, that's still behind pg_catalog, so the unqualified reference to pg_user in the CREATE INDEX command resolves as pg_catalog.pg_user. See http://www.postgresql.org/docs/8.3/static/ddl-schemas.html#DDL-SCHEMAS-CATALOG regards, tom lane