Re: Select all fields except one

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Select all fields except one
Date: 2007-11-28 17:26:50
Message-ID: 474DA4DA.6090100@cox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/28/07 11:18, Vivek Khera wrote:
>
> On Nov 28, 2007, at 11:06 AM, Matt Doughty wrote:
>
>> 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
>>
>>
>
> For best practices, you should never use select * in your queries. You
> will inevitably end up with code that cannot deal with a schema change,
> and for any live system, you will have a schema change at some point...

Remember back in the late-80s when Data Dictionaries were the rage?
(Some legacy still have these.) 3GL structs/copybooks can be
auto-generated from the CDD, so any added columns are auto-added to
your record structure.

Of course, you still have to rebuild your apps.

> It is best to explicitly list the field names your code is expecting.
> Besides, I don't think you can do what you want to do with just SQL.

- --
Ron Johnson, Jr.
Jefferson LA USA

%SYSTEM-F-FISH, my hovercraft is full of eels
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHTaTaS9HxQb37XmcRAiaWAJ9/BiarNsC9UUNyreg8LiIq9+mUKwCeNS/L
1y4DkS4vJbJd15ZbPuwalac=
=QZG7
-----END PGP SIGNATURE-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gauthier, Dave 2007-11-28 17:28:43 Re: Select all fields except one
Previous Message Erik Jones 2007-11-28 17:25:28 Re: Config settings for large restore