Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."? - Mailing list pgsql-hackers

From Eric Ridge
Subject Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?
Date
Msg-id CANcm6waeUR36x8Umc0i7dJfwGbXusfiOpw4qykSkRTNfF4bB3w@mail.gmail.com
Whole thread Raw
In response to Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?  (Mark Mielke <mark@mark.mielke.cc>)
Responses Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?
Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?
Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?
List pgsql-hackers
On Sun, Oct 30, 2011 at 3:38 PM, Mark Mielke <mark@mark.mielke.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


pgsql-hackers by date:

Previous
From: Mark Mielke
Date:
Subject: Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?
Next
From: Tom Lane
Date:
Subject: Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?