Re: Suggestion: Issue warning when calling SET TRANSACTION outside transaction block - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Suggestion: Issue warning when calling SET TRANSACTION outside transaction block
Date
Msg-id 20131003150513.GD19661@awork2.anarazel.de
Whole thread Raw
In response to Re: Suggestion: Issue warning when calling SET TRANSACTION outside transaction block  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Suggestion: Issue warning when calling SET TRANSACTION outside transaction block  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
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.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: record identical operator - Review
Next
From: Stephen Frost
Date:
Subject: Re: record identical operator