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 | test16413 | test116416 | "'test2'"16419 | "testcolumnVIEW"16422 | testcolumnview16425
|testcolumnview216428 | "1test2abc"16431 | "1test2"16434 | "1test"
(9 rows)
Is this a bug?
manu
--
Emmanuel Cecchet
Aster Data Systems
Web: http://www.asterdata.com