Re: bug regclass::oid - Mailing list pgsql-general

From Adrian Klaver
Subject Re: bug regclass::oid
Date
Msg-id 66c3ca92-8276-669f-6f9e-d20a6f32ee10@aklaver.com
Whole thread Raw
In response to Re: bug regclass::oid  (John Mikel <blpmftat@gmail.com>)
List pgsql-general
On 6/17/19 1:58 AM, John Mikel wrote:
> 
> hi again
> 
> 
> here is my query
> *select   A.table_name  as "table_name",A.domain_name as "domain",*
> * format_type(c.atttypid, c.atttypmod)  AS data_type ,A.column_name as 
> "column_name",*
> *  A.is_nullable as "nullable",A.column_default as "default"*
> *  from information_schema.columns A inner  join pg_attribute c  on 
>   a.table_name::regclass::oid=c.attrelid*
> *  where  a.table_schema in (select current_schema()) and  a.column_name 
> =c.attname ;*
> 
> if i run this query in any database contain at least one table with 
> space in their name , an error will occur
> if i run this query in other database will work fine
> I tested this on pg 11.1  , pg 10.3, pg 9.6
> 
> PS:Sorry if this message is duplicated i canceled the previous message 
> by mistake by clicking on link
>

The previous message came through, see the replies. The basic issue is 
that a table name with a space in it will need to be quoted. So use 
quote_ident() per Peter and Tom's suggestions.


-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Async client libraries - not worth it?
Next
From: Leandro Guimarães
Date:
Subject: Re: Copy Bulk Ignore Duplicated