Re: find column names from query

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Afton & Ray Still <rastill(at)shaw(dot)ca>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: find column names from query
Date: 2005-01-24 15:47:17
Message-ID: 20050124154717.GA43578@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Afton & Ray Still 2005-01-24 15:59:43 Re: find column names from query
Previous Message Afton & Ray Still 2005-01-24 14:12:25 Re: find column names from query