Re: SELECT <all fields except "bad_field"> from mytbl;

From: Rodrigo De León <rdeleonp(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: SELECT <all fields except "bad_field"> from mytbl;
Date: 2007-05-30 04:48:08
Message-ID: 1180500488.564914.160960@p47g2000hsd.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On May 29, 11:35 pm, Erwin Brandstetter <brsaw(dot)(dot)(dot)(at)gmail(dot)com> wrote:
> EXECUTE
> 'SELECT '
> || (SELECT array_to_string(ARRAY(
> SELECT a.attname
> FROM pg_class c, pg_namespace nc, pg_attribute a
> WHERE c.relname = 'v_event'
> AND c.relnamespace = nc.oid
> AND nc.nspname = 'stdat'
> AND a.attrelid = c.oid
> AND a.attname <> 'log_up'), ', '))
> || ' FROM stdat.v_event';

You might want to add:

AND a.attnum >=1

to remove "tableoid" and friends from the output.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message novnov 2007-05-30 04:53:29 Re: function retuning refcursor, order by ignored?
Previous Message Erwin Brandstetter 2007-05-30 04:35:13 Re: SELECT <all fields except "bad_field"> from mytbl;