Re: [HACKERS] SQL statements: begin and end

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zeugswetter Andreas SEV <ZeugswetterA(at)wien(dot)spardat(dot)at>
Cc: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>, "'Bruce Momjian'" <maillist(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: [HACKERS] SQL statements: begin and end
Date: 1999-11-23 14:59:54
Message-ID: 6087.943369194@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Zeugswetter Andreas SEV <ZeugswetterA(at)wien(dot)spardat(dot)at> writes:
> I see everybody using the following PostgreSQL statements:
> "begin" instead of "begin work"
> "end" instead of "commit work"
> This is really bad, because it is not standard,

I went looking in the SQL spec to confirm this, and was rather
startled to discover that BEGIN is not SQL at all! The SQL spec
seems to envision the always-in-a-transaction-block model of operation.
They have
<commit statement> ::=
COMMIT [ WORK ]
which is defined to commit the current transaction; but a new xact is
implicitly started by the next SQL operation (cf. sec. 4.28 in SQL92).

If we wanted to be completely standards-conformant, I think we'd have to
abandon the begin/end model entirely. I wouldn't support that ---
auto commit of standalone statements is too convenient.

Bottom line: pointing at the spec is a very weak argument for telling
people how to spell their begin/end statements.

> I vote for issuing a NOTICE for these in V7 and remove them in V8,
> at least the single "end"

My feeling is that application authors have already decided whether
they prefer "BEGIN" or "BEGIN TRANSACTION" or "BEGIN WORK", and trying
to enforce a single standard now is just going to irritate people and
break existing applications. I vote for leaving well enough alone.

> Bruce, please don't use "begin" and "end" in your book.

Sure, it makes sense for the book to consistently use "BEGIN WORK"
and "COMMIT WORK", which are probably the least likely to confuse
novices. But I think actually removing the other variants would be
just an exercise in causing trouble.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 1999-11-23 15:16:58 Re: [HACKERS] SQL statements: begin and end
Previous Message Vince Vielhaber 1999-11-23 14:58:04 Re: [DOCS] RE: file name error (fwd)