Thread: pg_type name quotability

pg_type name quotability

From
Kevin Wooten
Date:
Does anybody know if the name of a type/table in these system tables is guaranteed to be in a quotable format?  Ran
intoa specific instance where the table name needs to be quoted by the driver (e.g. “user”) but want to make sure it’s
alwaysvalid to quote the name from pg_type. 

Thanks!

Re: pg_type name quotability

From
Dave Cramer
Date:
Hi Kevin,

No, but let me know when you figure it out!

Quoting identifiers in postgres has always been problematic. PgAdmin takes the position that everything gets quoted, regardless which has it's own issues


On 2 December 2015 at 05:21, Kevin Wooten <kdubb@me.com> wrote:
Does anybody know if the name of a type/table in these system tables is guaranteed to be in a quotable format?  Ran into a specific instance where the table name needs to be quoted by the driver (e.g. “user”) but want to make sure it’s always valid to quote the name from pg_type.

Thanks!

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

Re: pg_type name quotability

From
Tom Lane
Date:
Kevin Wooten <kdubb@me.com> writes:
> Does anybody know if the name of a type/table in these system tables is guaranteed to be in a quotable format?  Ran
intoa specific instance where the table name needs to be quoted by the driver (e.g. “user”) but want to make sure it’s
alwaysvalid to quote the name from pg_type. 

AFAIK, locutions like quote_ident(pg_type.typname) should always
work, keeping in mind the possible need to schema-qualify as well.
This will often not give you what you might think is the most common
name for the type, but it will parse correctly.

            regards, tom lane