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: Andres Freund <andres(at)2ndquadrant(dot)com>, 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-10-04 17:50:46
Message-ID: 20131004175046.GA12277@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 4, 2013 at 09:40:38AM +0530, Amit Kapila wrote:
> On Thu, Oct 3, 2013 at 8:35 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> > On 2013-09-30 22:19:31 -0400, Bruce Momjian wrote:
> >> On Sun, Sep 29, 2013 at 11:40:51AM +0530, Amit Kapila wrote:
> >> > >> Shouldn't we do it for Set Constraints as well?
> >> > >
> >> > > Oh, very good point. I missed that one. Updated patch attached.
> >>
> >> I am glad you are seeing things I am not. :-)
> >>
> >> > 1. The function set_config also needs similar functionality, else
> >> > there will be inconsistency, the SQL statement will give error but
> >> > equivalent function set_config() will succeed.
> >> >
> >> > SQL Command
> >> > postgres=# set local search_path='public';
> >> > ERROR: SET LOCAL can only be used in transaction blocks
> >> >
> >> > Function
> >> > postgres=# select set_config('search_path', 'public', true);
> >> > set_config
> >> > ------------
> >> > public
> >> > (1 row)
> >>
> >> I looked at this but could not see how to easily pass the value of
> >> 'isTopLevel' down to the SELECT. All the other checks have isTopLevel
> >> passed down from the utility case statement.
> >
> > Doesn't sound like a good idea to prohibit that anyway, it might
> > intentionally be used as part of a more complex statement where it only
> > should take effect during that single statement.
>
> Agreed and I think it is good reason for not changing behaviour of
> set_config().

Applied. Thank you for all your suggestions.

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

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2013-10-04 18:05:55 Re: insert throw error when year field len > 4 for timestamptz datatype
Previous Message Stephen Frost 2013-10-04 17:39:25 Re: pg_dump insert with column names speedup