Thread: sharing variables between client and server again

sharing variables between client and server again

From
Pavel Stehule
Date:
Hello

this is VIP patch that implements shared - "status" variables to
PostgreSQL. A motivation for this features is possibility to take
client parameters inside inlined PL blocks.

This design is based on Magnus's ideas. Content is synchronized
between server and client. This doesn't need a protocol enhancing.

pavel ~ $ psql postgres -v status.myparam=Hello
psql (9.3devel)
Type "help" for help.

postgres=# \echo :status.myparam
Hello
postgres=# show status.myparam;
 status.myparam
----------------
 Hello
(1 row)

postgres=# do $$ begin raise notice '%',
current_setting('status.myparam'); end $$ language plpgsql;
NOTICE:  Hello
DO

postgres=# set status.myparam = 'Bobo';
SET
postgres=# \echo :status.myparam
Bobo

postgres=# \set status.myparam Otis
postgres=# show status.myparam;
 status.myparam
----------------
 Otis
(1 row)

Regards

Pavel Stehule

Attachment