Re: BEGIN vs START TRANSACTION

Lists: pgsql-hackerspgsql-patches
From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: BEGIN vs START TRANSACTION
Date: 2003-10-27 00:22:04
Message-ID: 3F9C652C.1080106@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Hi all,
why START TRANSACTION READ ONLY is allowed
and not BEGIN READ ONLY ?

Regards
Gaetano Mendola


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gaetano Mendola <mendola(at)bigfoot(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BEGIN vs START TRANSACTION
Date: 2003-10-27 03:05:29
Message-ID: 200310270305.h9R35T214534@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Gaetano Mendola wrote:
> Hi all,
> why START TRANSACTION READ ONLY is allowed
> and not BEGIN READ ONLY ?

I think because START TRANSACTION is SQL standard? However, I thought
BEGIN WORK was SQL standard, and we don't support READ ONLY there
either --- hmmm.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Gaetano Mendola <mendola(at)bigfoot(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BEGIN vs START TRANSACTION
Date: 2003-10-27 03:15:56
Message-ID: 3F9C8DEC.4030009@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

> I think because START TRANSACTION is SQL standard? However, I thought
> BEGIN WORK was SQL standard, and we don't support READ ONLY there
> either --- hmmm.

BEGIN is no part of the SQL standard. The only way to begin a
transaction under the SQL standard is START TRANSACTION.

Chris


From: Neil Conway <neilc(at)samurai(dot)com>
To: Gaetano Mendola <mendola(at)bigfoot(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BEGIN vs START TRANSACTION
Date: 2003-10-27 09:00:14
Message-ID: 1067245214.460.7.camel@tokyo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Sun, 2003-10-26 at 19:22, Gaetano Mendola wrote:
> Hi all,
> why START TRANSACTION READ ONLY is allowed
> and not BEGIN READ ONLY ?

As Chris KL points out, it's not required by the standard (since BEGIN
isn't part of the standard to begin with). I suppose we could add it,
but it seems a little pointless -- "BEGIN ; SET ..." seems just as good.

-Neil


From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Subject: Re: BEGIN vs START TRANSACTION
Date: 2003-10-27 09:26:27
Message-ID: 3F9CE4C3.2000609@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Christopher Kings-Lynne wrote:
>> I think because START TRANSACTION is SQL standard? However, I thought
>> BEGIN WORK was SQL standard, and we don't support READ ONLY there
>> either --- hmmm.
>
>
> BEGIN is no part of the SQL standard. The only way to begin a
> transaction under the SQL standard is START TRANSACTION.

These IMHO means push people to not use BEGIN anymore.

Regards
Gaetano Mendola


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gaetano Mendola <mendola(at)bigfoot(dot)com>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BEGIN vs START TRANSACTION
Date: 2003-11-09 03:07:29
Message-ID: 200311090307.hA937Te11012@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Gaetano Mendola wrote:
> Hi all,
> why START TRANSACTION READ ONLY is allowed
> and not BEGIN READ ONLY ?

Seems it should be allowed so that BEGIN and START TRANSACTION behave
the same.

In fact, the BEGIN manual page says:

<xref linkend="sql-start-transaction"
endterm="sql-start-transaction-title"> has the same functionality
as <command>BEGIN</>.

which is currently not true because START TRANSACTION has additional
options. The following patch fixes it. I will put it into 7.5 after an
appropriate delay.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 3.6 KB

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Gaetano Mendola <mendola(at)bigfoot(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BEGIN vs START TRANSACTION
Date: 2003-11-09 09:18:33
Message-ID: Pine.LNX.4.44.0311091017501.11030-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Bruce Momjian writes:

> In fact, the BEGIN manual page says:
>
> <xref linkend="sql-start-transaction"
> endterm="sql-start-transaction-title"> has the same functionality
> as <command>BEGIN</>.
>
> which is currently not true because START TRANSACTION has additional
> options.

Then the that manual page should be fixed.

> The following patch fixes it. I will put it into 7.5 after an
> appropriate delay.

I object to adding unnecessary complications like that.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Gaetano Mendola <mendola(at)bigfoot(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BEGIN vs START TRANSACTION
Date: 2003-11-09 14:05:11
Message-ID: 200311091405.hA9E5BM06993@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Peter Eisentraut wrote:
> Bruce Momjian writes:
>
> > In fact, the BEGIN manual page says:
> >
> > <xref linkend="sql-start-transaction"
> > endterm="sql-start-transaction-title"> has the same functionality
> > as <command>BEGIN</>.
> >
> > which is currently not true because START TRANSACTION has additional
> > options.
>
> Then the that manual page should be fixed.
>
> > The following patch fixes it. I will put it into 7.5 after an
> > appropriate delay.
>
> I object to adding unnecessary complications like that.

Shouldn't BEGIN and START TRANSACTION have the same mechanics? The
changes to the code were the addition of only one line. The rest of the
patch was docs.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Gaetano Mendola <mendola(at)bigfoot(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BEGIN vs START TRANSACTION
Date: 2003-11-09 15:18:18
Message-ID: 3269.1068391098@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Peter Eisentraut wrote:
>> I object to adding unnecessary complications like that.

> Shouldn't BEGIN and START TRANSACTION have the same mechanics? The
> changes to the code were the addition of only one line. The rest of the
> patch was docs.

My initial reaction was the same as Peter's, but after seeing the small
size of the patch I reconsidered. It seems to make sense that BEGIN
should be an exact synonym for START TRANSACTION.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Gaetano Mendola <mendola(at)bigfoot(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BEGIN vs START TRANSACTION
Date: 2003-11-10 03:10:47
Message-ID: 200311100310.hAA3Al428467@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Peter Eisentraut wrote:
> >> I object to adding unnecessary complications like that.
>
> > Shouldn't BEGIN and START TRANSACTION have the same mechanics? The
> > changes to the code were the addition of only one line. The rest of the
> > patch was docs.
>
> My initial reaction was the same as Peter's, but after seeing the small
> size of the patch I reconsidered. It seems to make sense that BEGIN
> should be an exact synonym for START TRANSACTION.

Let me give you my logic on this --- if people think of BEGIN and START
TRANSACTION as the same, and they do \h begin, they aren't going to see
the read only and isolation options for START TRANSACTION, and I doubt
they are going to think to look there because they think they are the
same. That's why I think it is good to add those clauses to BEGIN
WORK/TRANSACTION.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Gaetano Mendola <mendola(at)bigfoot(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BEGIN vs START TRANSACTION
Date: 2003-11-10 16:02:32
Message-ID: 3FAFB698.6020101@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Bruce Momjian wrote:

> Tom Lane wrote:
>> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
>> > Peter Eisentraut wrote:
>> >> I object to adding unnecessary complications like that.
>>
>> > Shouldn't BEGIN and START TRANSACTION have the same mechanics? The
>> > changes to the code were the addition of only one line. The rest of the
>> > patch was docs.
>>
>> My initial reaction was the same as Peter's, but after seeing the small
>> size of the patch I reconsidered. It seems to make sense that BEGIN
>> should be an exact synonym for START TRANSACTION.
>
> Let me give you my logic on this --- if people think of BEGIN and START
> TRANSACTION as the same, and they do \h begin, they aren't going to see
> the read only and isolation options for START TRANSACTION, and I doubt
> they are going to think to look there because they think they are the
> same. That's why I think it is good to add those clauses to BEGIN
> WORK/TRANSACTION.
>

Since BEGIN isn't standard, wouldn't it be time to redirect them on the
BEGIN manpage to the START TRANSACTION manpage and tell them there that
BEGIN does not support the full syntax of START TRANSACTION?

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Gaetano Mendola <mendola(at)bigfoot(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BEGIN vs START TRANSACTION
Date: 2003-11-10 16:20:43
Message-ID: 200311101620.hAAGKhK26962@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Jan Wieck wrote:
> Bruce Momjian wrote:
>
> > Tom Lane wrote:
> >> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> >> > Peter Eisentraut wrote:
> >> >> I object to adding unnecessary complications like that.
> >>
> >> > Shouldn't BEGIN and START TRANSACTION have the same mechanics? The
> >> > changes to the code were the addition of only one line. The rest of the
> >> > patch was docs.
> >>
> >> My initial reaction was the same as Peter's, but after seeing the small
> >> size of the patch I reconsidered. It seems to make sense that BEGIN
> >> should be an exact synonym for START TRANSACTION.
> >
> > Let me give you my logic on this --- if people think of BEGIN and START
> > TRANSACTION as the same, and they do \h begin, they aren't going to see
> > the read only and isolation options for START TRANSACTION, and I doubt
> > they are going to think to look there because they think they are the
> > same. That's why I think it is good to add those clauses to BEGIN
> > WORK/TRANSACTION.
> >
>
> Since BEGIN isn't standard, wouldn't it be time to redirect them on the
> BEGIN manpage to the START TRANSACTION manpage and tell them there that
> BEGIN does not support the full syntax of START TRANSACTION?

Yea, we could do that, and if it was hard to add, we would, but it seems
easier to just say BEGIN and START TRANSACTION are the same except the
later is standard, rather than have the later have additional
functionality too.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Jan Wieck <JanWieck(at)Yahoo(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Gaetano Mendola <mendola(at)bigfoot(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BEGIN vs START TRANSACTION
Date: 2003-11-10 16:23:20
Message-ID: 4700.1068481400@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Jan Wieck wrote:
>> Since BEGIN isn't standard, wouldn't it be time to redirect them on the
>> BEGIN manpage to the START TRANSACTION manpage and tell them there that
>> BEGIN does not support the full syntax of START TRANSACTION?

> Yea, we could do that, and if it was hard to add, we would, but it seems
> easier to just say BEGIN and START TRANSACTION are the same except the
> later is standard, rather than have the later have additional
> functionality too.

IIRC, the code patch only added about two lines to gram.y. It seems a
bit silly to add *more* lines of documentation to explain that the two
statements aren't alike than it would take lines of code to make them
work alike.

regards, tom lane


From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Jan Wieck <JanWieck(at)Yahoo(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Gaetano Mendola <mendola(at)bigfoot(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BEGIN vs START TRANSACTION
Date: 2003-11-10 17:05:31
Message-ID: 20031110170531.GB6483@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Mon, Nov 10, 2003 at 11:23:20AM -0500, Tom Lane wrote:

> IIRC, the code patch only added about two lines to gram.y. It seems a
> bit silly to add *more* lines of documentation to explain that the two
> statements aren't alike than it would take lines of code to make them
> work alike.

But maybe it would be useful to point out the difference; for example,
users will get confused if they try to start a subtransaction inside a
plpgsql function using BEGIN.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El miedo atento y previsor es la madre de la seguridad" (E. Burke)