Re: Suggestion: Issue warning when calling SET TRANSACTION outside transaction block

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Morten Hustveit <morten(at)eventures(dot)vc>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Suggestion: Issue warning when calling SET TRANSACTION outside transaction block
Date: 2013-09-24 21:25:51
Message-ID: 20130924212551.GA21534@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 12, 2013 at 09:38:43AM +0530, Amit Kapila wrote:
> > I have created the attached patch which issues an error when SET
> > TRANSACTION and SET LOCAL are used outside of transactions:
> >
> > test=> set transaction isolation level serializable;
> > ERROR: SET TRANSACTION can only be used in transaction blocks
> > test=> reset transaction isolation level;
> > ERROR: RESET TRANSACTION can only be used in transaction blocks
> >
> > test=> set local effective_cache_size = '3MB';
> > ERROR: SET LOCAL can only be used in transaction blocks
> > test=> set local effective_cache_size = default;
> > ERROR: SET LOCAL can only be used in transaction blocks
>
> Shouldn't we do it for Set Constraints as well?

Oh, very good point. I missed that one. Updated patch attached.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

Attachment Content-Type Size
set.diff text/x-diff 4.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2013-09-24 21:36:58 Re: unaccent module - two params function should be immutable
Previous Message Fabien COELHO 2013-09-24 20:41:17 Re: pgbench progress report improvements - split 3 v2