Thread: Set server behaviors on a per-session basis?

Set server behaviors on a per-session basis?

From
Ken Johanson
Date:
(re-post, last seemed not to get on-list)

Hi all,

In the link below we asked if it was possible to set, in this case, the
standard_conforming_strings behavior, on a per-connection basis.


http://www.grokbase.com/topic/2006/07/27/backslash-as-ordinary-char-vs-not-set-via-a-connection-session-variable/PwunvQ3dQxAVOpprZ606aKELsYU

The responses were good to see -- the ability to set it on a role or
database context is great.. however in some hosting / shared
environments, one-role per behavior isn't always practical, even though
it's arguably the ideal approach.

A first question: will the current server design easily allow some
change that lets us set behaviors (like standard_conforming_strings) on
a per-connection basis? Or are per-connection behaviors a substantial
rework?

A second question: is support for a general notion of "behavior" on the
roadmap for any of the three contexts (roles, database, sessions)? Not
just standard_conforming_strings, but both conformant and non behaviors.
Say accepting relaxed typing (quoted ints etc), implicit AS-keyword in
SELECT lists (someday and in sacrifice of regclass), etc. Even to allow
newer PGs to behave as old ones.

These two features would ease migration *from* non-compliant/3rd party
DBs -- and also to ease PG itself *into* standard-compliant modes (e.g
'implicit AS-keyword in SELECT lists'). Also may allow some blackbox
apps to migrate from 3rd party DBs.

-Ken





Re: Set server behaviors on a per-session basis?

From
Tom Lane
Date:
Ken Johanson <pg-user@kensystem.com> writes:
> A first question: will the current server design easily allow some
> change that lets us set behaviors (like standard_conforming_strings) on
> a per-connection basis?

See the SET command.  Or maybe you should read the overview here:
http://www.postgresql.org/docs/8.3/static/config-setting.html

            regards, tom lane