Re: last comma inside "CREATE TABLE ()" statements - Mailing list pgsql-general
From | Rod Taylor |
---|---|
Subject | Re: last comma inside "CREATE TABLE ()" statements |
Date | |
Msg-id | 046101c0cf1c$51cfa310$1600a8c0@jester Whole thread Raw |
In response to | last comma inside "CREATE TABLE ()" statements (Louis-David Mitterrand <vindex@apartia.ch>) |
Responses |
Re: last comma inside "CREATE TABLE ()" statements
|
List | pgsql-general |
Heh.. Actually, those queries look quite good if you centre them in a page -- Assuming all characters are the same width anyway. SELECT, FROM, and other key words go onto the left column along with comma's, and the relevant database columns, tables, and where clauses go on the right. With a good naming convention I don't even have to look at the left hand side of the query but rather just the list of entities on the right. It also means every line has a left side and a right side. Anyway, not that it matters much but If the loose grammar is implemented it should be optional and off by default. -- Rod Taylor There are always four sides to every story: your side, their side, the truth, and what really happened. ----- Original Message ----- From: "will trillich" <will@serensoft.com> To: <pgsql-general@postgresql.org> Sent: Friday, April 27, 2001 12:56 AM Subject: Re: [GENERAL] last comma inside "CREATE TABLE ()" statements > 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@serensoft.com > http://sourceforge.net/projects/newbiedoc -- we need your brain! > http://www.dontUthink.com/ -- your brain needs us! > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >
pgsql-general by date: