From: | will trillich <will(at)serensoft(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: last comma inside "CREATE TABLE ()" statements |
Date: | 2001-04-27 04:56:55 |
Message-ID: | 20010426235655.D21240@serensoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Apr 26, 2001 at 10:38:42AM -0400, Rod Taylor wrote:
> Gah.. just put comma's at the beginning...
Oh, now THAT's intuitive:
. To be
, or not to be
, that is the question
. Whether 'tis nobler...
Charming. :)
> SELECT bleah
> , blah
> , otherthing
> FROM arghh
> , feh
> , fah
> WHERE ( blah in ('1'
> , '2'
> , '3')
> OR otherthing IS TRUE
> )
> OR bleah IS FALSE
>
> Oh, and indent nicer. You can remove virtually any line (except the
> ones with commands in them) without any issues.
What that does, is it transfers the location of the problem. Now
the comma is effectively in FRONT of most terms, except the
FIRST.
An alternative compromise:
select
first
,
second
,
third
,
fourth
from
alpha
,
bravo
,
charlie
;
It's odd to use a whole line just for a florkin' comma, but in vi
"2ddkkP" or "2ddjjjjP" will rearrange things nicely, while
keeping the purists at bay (not to mention any names, but You
Know Who You Are :).
I'd still prefer to ALLOW (but not DEMAND) 'empty after last
comma'. Or if you're determined to go for 'empty before first
comma':
update tbl
set
,one = something
,two = something-else
,three = fn('hgttg',42)
,four = that
;
But i hope you'll agree that this is more obtuse than we need to
be. Not to mention the "speedbump" effect it'll have on the person
who's got to look over your code next month.
This looks much nicer, imho --
update tbl
set
one = something ,
two = something-else ,
three = fn('hgttg',42) ,
four = that ,
;
After all, the comma is of no importance to the conceptual task
we're after: i don't care if there's a token separating those
assignments -- i'm interested in the fields and the values being
assigned to them. The commas are just there to help us predict
that the compiler will understand what we're after.
And it's easy to rearrange those lines in a text editor without
having to be paranoid about "Do i need to add a comma somewhere?
Should i look to see if i should take one out?"
Computers should work. People should think. "Data! Mow the lawn!"
--
don't visit this page. it's bad for you. take my expert word for it.
http://www.salon.com/people/col/pagl/2001/03/21/spring/index1.html
will(at)serensoft(dot)com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!
From | Date | Subject | |
---|---|---|---|
Next Message | Anand Raman | 2001-04-27 05:30:11 | Re: Data Export from PostGreSQL |
Previous Message | will trillich | 2001-04-27 04:26:32 | Re: Classes of returned rows |