From: Adrian Klaver <adrian.klaver@aklaver.com>
To: John Mikel <blpmftat@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: bug regclass::oid
Date: Mon, 17 Jun 2019 07:11:32 -0700
Message-ID: <66c3ca92-8276-669f-6f9e-d20a6f32ee10@aklaver.com> (raw)
In-Reply-To: <CAAC-7YAOKcBmiNQFjskK7ywFEJ2rRzPQZy2gYcWGg+roHHzo7A@mail.gmail.com>
References: <CAAC-7YB4HUCZ2pq1FEndxYAzRgy8CcGzU0YGVsNAcDLm6nC6kw@mail.gmail.com>
<fc6a3ada-db64-a6e1-b5d7-4f4b2882eb4c@aklaver.com>
<CAAC-7YAOKcBmiNQFjskK7ywFEJ2rRzPQZy2gYcWGg+roHHzo7A@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, blpmftat@gmail.com
Subject: Re: bug regclass::oid
In-Reply-To: <66c3ca92-8276-669f-6f9e-d20a6f32ee10@aklaver.com>
References: <CAAC-7YB4HUCZ2pq1FEndxYAzRgy8CcGzU0YGVsNAcDLm6nC6kw@mail.gmail.com> <fc6a3ada-db64-a6e1-b5d7-4f4b2882eb4c@aklaver.com> <CAAC-7YAOKcBmiNQFjskK7ywFEJ2rRzPQZy2gYcWGg+roHHzo7A@mail.gmail.com> <66c3ca92-8276-669f-6f9e-d20a6f32ee10@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox