SET LOCAL again

Поиск
Список
Период
Сортировка
Искать

SET LOCAL again

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Earlier I had argued that SET LOCAL should not be used in the context it
is now, and I had suggested SET TRANSACTION as a replacement.  However,
now that I look at it in the implementation, this syntax is just too
bizzare and prone to confuse.

Here are a couple of examples of what is/would be possible.

SET SESSION SESSION AUTHORIZATION

(This is semantically valid, since the parameter is the "session
authorization" and you want it to last for the session.)

SET TRANSACTION SESSION AUTHORIZATION

(Clearly confusing)

SET SESSION TRANSACTION ISOLATION LEVEL

(Syntactically valid, but nonsensical.)

SET TRANSACTION TRANSACTION ISOLATION LEVEL

(Stupid)

SET TRANSACTION ISOLATION LEVEL

(This seems to imply that the parameter name is "isolation level" whereas
in fact the "transaction" belongs to the parameter name.)

SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL
SET TRANSACTION SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL

(OK, you get the idea...)

As an alternative syntax I can suggest

SET name TO value [ ON COMMIT RESET ];

I think this is painfully clear, is similar to other SQL standard
commands, and draws on existing terminology (COMMIT/RESET).  OK, slightly
more typing, I guess.

Comments?

-- 
Peter Eisentraut   peter_e@gmx.net


Re: SET LOCAL again

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Peter Eisentraut  writes:
> As an alternative syntax I can suggest

> SET name TO value [ ON COMMIT RESET ];

Ugh.  Why can't we stick with SET LOCAL?
		regards, tom lane

Re: SET LOCAL again

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Tom Lane writes:

> > As an alternative syntax I can suggest
>
> > SET name TO value [ ON COMMIT RESET ];
>
> Ugh.  Why can't we stick with SET LOCAL?

SET LOCAL is already used for something else in the SQL standard.  Not
sure if we'll ever implement that, but it's something to be concerned
about.

-- 
Peter Eisentraut   peter_e@gmx.net


Re: SET LOCAL again

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Peter Eisentraut  writes:
> Tom Lane writes:
> As an alternative syntax I can suggest
>> 
> SET name TO value [ ON COMMIT RESET ];
>> 
>> Ugh.  Why can't we stick with SET LOCAL?

> SET LOCAL is already used for something else in the SQL standard.  Not
> sure if we'll ever implement that, but it's something to be concerned
> about.

Actually, it looks to me like the spec's SET LOCAL has a compatible
interpretation: it only affects the current transaction.

My main gripe with "ON COMMIT RESET" is that it's a misleading
description of what will happen --- RESETting a variable is quite
different from allowing it to revert to the pre-transaction state.
		regards, tom lane

Re: SET LOCAL again

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Tom Lane wrote:
> Peter Eisentraut  writes:
> > Tom Lane writes:
> > As an alternative syntax I can suggest
> >> 
> > SET name TO value [ ON COMMIT RESET ];
> >> 
> >> Ugh.  Why can't we stick with SET LOCAL?
> 
> > SET LOCAL is already used for something else in the SQL standard.  Not
> > sure if we'll ever implement that, but it's something to be concerned
> > about.
> 
> Actually, it looks to me like the spec's SET LOCAL has a compatible
> interpretation: it only affects the current transaction.
> 
> My main gripe with "ON COMMIT RESET" is that it's a misleading
> description of what will happen --- RESETting a variable is quite
> different from allowing it to revert to the pre-transaction state.

I don't like stuff trailing off at the end, especially three words. 
That SET command is getting so big, it may fall over.  ;-)

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610) 853-3000 +  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: SET LOCAL again

От:
Thomas Swan <tswan@idigx.com>
Дата:
 Bruce Momjian wrote:
Tom Lane wrote: 
Peter Eisentraut <peter_e@gmx.net> writes:   
Tom Lane writes:
As an alternative syntax I can suggest     
SET name TO value [ ON COMMIT RESET ];     
Ugh.  Why can't we stick with SET LOCAL?       
SET LOCAL is already used for something else in the SQL standard.  Not
sure if we'll ever implement that, but it's something to be concerned
about.     
Actually, it looks to me like the spec's SET LOCAL has a compatible
interpretation: it only affects the current transaction.

My main gripe with "ON COMMIT RESET" is that it's a misleading
description of what will happen --- RESETting a variable is quite
different from allowing it to revert to the pre-transaction state.   
I don't like stuff trailing off at the end, especially three words. 
That SET command is getting so big, it may fall over.  ;-)
 
Perhaps ON COMMIT REVERT would be more intuitive.
FAQ