Regclass and quoted table names - Mailing list pgsql-hackers

From Emmanuel Cecchet
Subject Regclass and quoted table names
Date
Msg-id 49ADEBBB.2010108@asterdata.com
Whole thread Raw
Responses Re: Regclass and quoted table names  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Selena Deckelmann
Date:
Subject: Make SIGHUP less painful if pg_hba.conf is not readable
Next
From: Tom Lane
Date:
Subject: Re: Regclass and quoted table names