Search Postgresql Archives

Re: Select all fields except one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

On Wed, 28 Nov 2007 09:37:43 -0800
David Fetter <david@xxxxxxxxxx> 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);

Where the array list is is the list of fields you don't want selected
and the second parameter is the table you are going to use. Then you
just have to build the logic inside the function.

Sincerely,

Joshua D. Drake


> 
> Cheers,
> David.


- -- 

      === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564   24x7/Emergency: +1.800.492.2240
PostgreSQL solutions since 1997  http://www.commandprompt.com/
			UNIQUE NOT NULL
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHTamnATb/zqfZUUQRArcrAJwIfarEnOPTzE8nzoWOfocW2C1kyQCgm4iU
e6DgUTvJD3bJDarJkoVpk7Y=
=GO+V
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------TIP 9: In versions below 8.0, the planner will ignore your desire to       choose an index scan if your joining column's datatypes do not       match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux