Hi all,

It looks like the behavior of regclass is not consistent when table names are quoted. The name is returned without the quotes if the name is lower case with eventual trailing numbers, otherwise it is returned with quotes.
See some examples here:

tpch=# CREATE VIEW test AS SELECT * FROM customer;
CREATE VIEW
tpch=# CREATE VIEW "test1" AS SELECT * FROM customer;
CREATE VIEW
tpch=# CREATE VIEW "'test2'" AS SELECT * FROM customer;
CREATE VIEW
tpch=# CREATE VIEW "testcolumnVIEW" AS SELECT * FROM customer;
CREATE VIEW
tpch=# CREATE VIEW "testcolumnview" AS SELECT * FROM customer;
CREATE VIEW
tpch=# CREATE VIEW testcolumnVIEW2 AS SELECT * FROM customer;
CREATE VIEW
tpch=# CREATE VIEW "1test" AS SELECT * FROM customer;
CREATE VIEW
tpch=# CREATE VIEW "1test2abc" AS SELECT * FROM customer;
CREATE VIEW
tpch=# CREATE VIEW "1test2" AS SELECT * FROM customer;
CREATE VIEW
tpch=# select c.oid , c.oid::regclass from pg_class c where c.relname like '%test%'; oid | oid -------+------------------
16410 | test
16413 | test1
16416 | "'test2'"
16419 | "testcolumnVIEW"
16422 | testcolumnview
16425 | testcolumnview2
16428 | "1test2abc"
16431 | "1test2"
16434 | "1test"
(9 rows)


Is this a bug?
manu

--
Emmanuel Cecchet
Aster Data Systems
Web: http://www.asterdata.com


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to