Re: Select all fields except one

From: Vivek Khera <khera(at)kcilink(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Select all fields except one
Date: 2007-11-28 17:18:43
Message-ID: 03CFB7A4-A305-46F7-895C-E2F608114E6D@kcilink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


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...

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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2007-11-28 17:23:03 Re: Linux v.s. Mac OS-X Performance
Previous Message Magnus Hagander 2007-11-28 17:13:35 Re: Linux v.s. Mac OS-X Performance