Re: Select all fields except one

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: "David Fetter" <david(at)fetter(dot)org>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: "Matt Doughty" <matt(dot)doughty(at)geograma(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Select all fields except one
Date: 2007-11-28 18:56:07
Message-ID: D7FF158337303A419CF4A183F48302D603646469@hdsmsx411.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Seems odd that you'd know specifically which column you don't want, but
not know what columns you do want. And then not care what order those
desired columns happen to be be returned in.

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of David Fetter
Sent: Wednesday, November 28, 2007 1:15 PM
To: Joshua D. Drake
Cc: Matt Doughty; pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Select all fields except one

On Wed, Nov 28, 2007 at 09:47:19AM -0800, Joshua D. Drake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Wed, 28 Nov 2007 09:37:43 -0800
> David Fetter <david(at)fetter(dot)org> wrote:
>
> > On Wed, Nov 28, 2007 at 05:06:45PM +0100, Matt Doughty wrote:
> > > Hi,
> > >
> > > Is there a way of selecting all fields except for one in
> > > particular? I'd like to create a query that says something
> > > like:
> > >
> > > select * except fieldx
> > >
> > > What I'm hoping to achieve is a query that can be valid for a
> > > number of different tables, although the field I don't want to
> > > select is always called the same (field_not_wanted, for
> > > example).
> >
> > This sounds like self-modifying code. I'd submit that you're
> > trying to do the wrong thing in the first place, and that you
> > should look over your design for flaws like this and re-do that
> > design.
>
> Or to actually try to be helpful, you could consider using a server
> side function instead:
>
> select * from global_query({},TEXT);

Helping somebody shoot themselves in the foot isn't helping them.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2007-11-28 19:00:48 Re: [HACKERS] plperl and regexps with accented characters - incompatible?
Previous Message Alan Hodgson 2007-11-28 18:46:43 Re: How to automate password requests?