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

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Christopher Browne <cbbrowne(at)gmail(dot)com>, Darren Duncan <darren(at)darrenduncan(dot)net>, Eric Ridge <eebbrr(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Mark Mielke <mark(at)mark(dot)mielke(dot)cc>, David Wilson <david(dot)t(dot)wilson(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?
Date: 2011-11-01 22:17:40
Message-ID: 20111101221740.GC21872@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 31, 2011 at 09:14:48AM -0400, Andrew Dunstan wrote:
> The fact is that if you have 100 columns and want 95 of them, it's
> very tedious to have to specify them all, especially for ad hoc
> queries where the house SQL standards really don't matter that much.
> It's made more tedious by the fact that there is no real help in
> constructing the query. This gets particularly bad with views, which
> developers often seem to stuff with every available column that
> might be needed by some query instead of creating views tailored to
> particular queries. Not long ago annoyance with this prompted my to
> write a little utility function that would give me a query with all
> the columns specified so I could cut and paste it, and delete the
> columns I didn't want. (Another advantage is that the result is
> guaranteed typo free, which my typing certainly is not.) See
> <https://gist.github.com/818490>. It's far from perfect, but I still
> find myself using it several times a month, mainly for the very
> purpose intended by this suggested feature.
>

As I do the ad hoc query thing more than I'd like to admit, I think
there's a place for some form of negation for *. A workaround similar to
what you describe here would be to add special tab completion to psql
that would expand * to the full list (probably on double tab ...)

Ross
--
Ross Reedstrom, Ph.D. reedstrm(at)rice(dot)edu
Systems Engineer & Admin, Research Scientist phone: 713-348-6166
Connexions http://cnx.org fax: 713-348-3665
Rice University MS-375, Houston, TX 77005
GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E F888 D3AE 810E 88F0 BEDE

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-11-01 22:47:18 Re: Thoughts on "SELECT * EXCLUDING (...) FROM ..."?
Previous Message Robert Treat 2011-11-01 22:00:53 Re: IDLE in transaction introspection