Skip site navigation (1) Skip section navigation (2)

Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?

From: Eric Ridge <eebbrr(at)gmail(dot)com>
To: Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
Cc: Darren Duncan <darren(at)darrenduncan(dot)net>, David Wilson <david(dot)t(dot)wilson(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Subject: Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?
Date: 2011-10-30 19:50:12
Message-ID: CANcm6waeUR36x8Umc0i7dJfwGbXusfiOpw4qykSkRTNfF4bB3w@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Sun, Oct 30, 2011 at 3:38 PM, Mark Mielke <mark(at)mark(dot)mielke(dot)cc> wrote:
> Stupid question:
>
> Is this just a display thing?

Well, it's a "display thing" as much as any SELECT statement
(especially via psql) is a "display thing".  It's more like "I want
all 127 columns, except the giant ::xml column, and I'm too lazy to
type each column name out by hand".

> Or does this have impact for things such as COUNT(*) vs COUNT(1)?

If it does, it's broken.

> Is it "like a view, but on the fly"?

Naw, it's just short-hand for omitting columns from the output target
list.  As I'm envisioning the feature, it would be SQL-level syntax,
so you could bake it into a view, but...

> 1) Not standards compliant,

Sure, no doubt.  I think the "::typename" syntax is not standards
compliant either, and I bet I'm not the only Postgres user to use that
every day.  But I secretly tend to agree, I wouldn't necessarily want
to use this in production/application code.

> 2) Not deterministic (i.e. a database change might cause my code to break),

Okay, I'm inventing a use-case here, but say you have a "users" table
with various bits of metadata about the user, including password.
Maybe, regardless of database changes, you never want the password
column returned:  SELECT * EXCLUDING (password) FROM tbl_users;

Changes of omission can break your code just as easily.

> 3) Working around a problem that maybe shouldn't exist in the first place? It's
> a like buying a rug, so that nobody sees the scratches on the floor.

Sometimes, rugs are cheaper than new floors.

eric

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2011-10-30 20:03:57
Subject: Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?
Previous:From: Mark MielkeDate: 2011-10-30 19:38:01
Subject: Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group