Re: find column names from query - Mailing list pgsql-novice

From Michael Fuhr
Subject Re: find column names from query
Date
Msg-id 20050124154717.GA43578@winnie.fuhr.org
Whole thread Raw
In response to Re: find column names from query  (Afton & Ray Still <rastill@shaw.ca>)
List pgsql-novice
On Mon, Jan 24, 2005 at 07:12:25AM -0700, Afton & Ray Still wrote:
> >
> > Are you sure the example looked like that?
>
> The original example was:
> SELECT attrelid::regclass, array_accum(attname)
>    FROM pg_attribute
>    WHERE attnum > 0 AND attrelid = 'pg_user'::regclass
>    GROUP BY attrelid;but (copied from above) I cut it down toSELECT
> attname::regclass FROM pg_attribute WHERE attrelid = travel::regclass
> (oops, missed the ''. I also used a different table name.as found
> at:http://www.postgresql.org/docs/8.0/interactive/xaggr.html

Notice that the original has attrelid::regclass but you changed it
to attname::regclass -- that change caused the "cannot cast type
name to regclass" error that you originally reported.  See the
"Object Identifier Types" section in the "Data Types" chapter of
the documentation for more info about regclass, and the "pg_attribute"
section in the "System Catalogs" chapter for more info about the
columns in that table.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-novice by date:

Previous
From: Afton & Ray Still
Date:
Subject: Re: find column names from query
Next
From: Afton & Ray Still
Date:
Subject: Re: find column names from query