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

From Stephen Frost
Subject Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?
Date
Msg-id 20111029223547.GM24234@tamriel.snowman.net
Whole thread Raw
In response to Thoughts on "SELECT * EXCLUDING (...) FROM ..."?  (Eric Ridge <eebbrr@gmail.com>)
Responses Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?
List pgsql-hackers
Eric,

* Eric Ridge (eebbrr@gmail.com) wrote:
> It seems like such a syntax would better document the
> intent of a query too, rather than leaving one wondering if "big_col1"
> was supposed to be omitted from the target list or not.

Well, I expect most here would say that any application query should be
specific about exactly what columns it wants (iow- don't use select * in
your apps :).  As for it being useful in psql, I could see that.

> Anyways, I just wanted to run the idea by youse guys before I put too
> much more effort into it.  I've already made what appear to be the
> minimum necessary changes to gram.y, and a few quick greps through the
> code make me think the rest will be pretty easy.
>
> Maybe the SQL spec says something about this and nobody's done the work yet?

I don't know of anything like this in the spec.  Also, there would be
concern about this possibly going against spec, breaking possibly valid
queries, promoting keywords to reserved words, and maybe ending up in a
bad situation if the SQL committee decides to support that kind of
syntax for something completely different.

In general, I doubt this is something we'd implement, but others may
feel differently.  What might be interesting to consider is how hard it
would be to make psql smarter when it comes to line editing in this
regard.  Maybe if there was a way to easily expand the '*' from psql and
then you could remove the columns from the list easily..?
Thanks,
    Stephen

pgsql-hackers by date:

Previous
From: Eric Ridge
Date:
Subject: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?
Next
From: Eric Ridge
Date:
Subject: Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?