Re: [GENERAL] custom session variables?

2013-04-25 Thread Fabrízio de Royes Mello
On Thu, Apr 25, 2013 at 1:17 AM, Darren Duncan dar...@darrenduncan.netwrote: On 2013.04.24 7:16 PM, � wrote: Maybe you must see this extension [1] ;-) [1] http://pgxn.org/dist/session_**variables/http://pgxn.org/dist/session_variables/ Fabrízio de Royes Mello Thanks for your response.

[GENERAL] custom session variables?

2013-04-24 Thread Darren Duncan
Hello, I would like to have one or more session-scoped global variables that are useable in a similar way to sequence generators, via analogies to setval()+currval(). Here's a (simplified) scenario ... Say that for auditing purposes all regular database tables have a changeset_id column,

Re: [GENERAL] custom session variables?

2013-04-24 Thread Christian Hammers
Hello You could just use temporary tables like: BEGIN; CREATE TEMPORARY TABLE csid (i int); -- somehow write the ID you want into that table -- and then... INSERT INTO other_table (changeset_ids, msg) VALUES ((SELECT i FROM csid), 'Some log message'); COMMIT; When

Re: [GENERAL] custom session variables?

2013-04-24 Thread Darren Duncan
Thank you for that. I had actually thought of this, but it seemed to me that using a temporary table was a heavy-handed approach and that a temporary scalar variable would be more efficient or less verbose to use. It is *a* solution certainly, and potentially a better one than the url I

Re: [GENERAL] custom session variables?

2013-04-24 Thread Fabrízio de Royes Mello
On Wed, Apr 24, 2013 at 9:47 PM, Darren Duncan dar...@darrenduncan.netwrote: Thank you for that. I had actually thought of this, but it seemed to me that using a temporary table was a heavy-handed approach and that a temporary scalar variable would be more efficient or less verbose to use.

Re: [GENERAL] custom session variables?

2013-04-24 Thread Darren Duncan
On 2013.04.24 7:16 PM, � wrote: Maybe you must see this extension [1] ;-) [1] http://pgxn.org/dist/session_variables/ Fabrízio de Royes Mello Thanks for your response. /* * Author: Fabrízio de Royes Mello * Created at: Thu Oct 27 14:37:36 -0200 2011 * */ CREATE FUNCTION

[GENERAL] Custom session variables?

2007-03-02 Thread Adam Rich
Is there any way to define custom variables per session scope? In oracle, we do this using package variables. Basically when a user logs into our application, it generates one-time session information that we want to make available to all the procedures and triggers, without passing it directly

Re: [GENERAL] Custom session variables?

2007-03-02 Thread Kenneth Downs
Adam Rich wrote: Is there any way to define custom variables per session scope? In oracle, we do this using package variables. This would be so cool to have. -- Kenneth Downs Secure Data Software, Inc. www.secdat.com / www.andromeda-project.org Office: 631-689-7200 Cell: 631-379-0010

Re: [GENERAL] Custom session variables?

2007-03-02 Thread David Fetter
On Fri, Mar 02, 2007 at 01:53:28PM -0600, Adam Rich wrote: Is there any way to define custom variables per session scope? You can have them in PL/Perl(U), PL/Tcl(U) and PL/PythonU and other such PLs, and you can create SQL accessors for them. Cheers, D -- David Fetter [EMAIL PROTECTED]

Re: [GENERAL] Custom session variables?

2007-03-02 Thread Tom Lane
David Fetter [EMAIL PROTECTED] writes: On Fri, Mar 02, 2007 at 01:53:28PM -0600, Adam Rich wrote: Is there any way to define custom variables per session scope? You can have them in PL/Perl(U), PL/Tcl(U) and PL/PythonU and other such PLs, and you can create SQL accessors for them. Another

Re: [GENERAL] Custom session variables?

2007-03-02 Thread Adam Rich
Any way to pull the value of a config variable into a pl/pgsql variable? -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Friday, March 02, 2007 3:46 PM To: David Fetter Cc: Adam Rich; pgsql-general@postgresql.org Subject: Re: [GENERAL] Custom session variables

Re: [GENERAL] Custom session variables?

2007-03-02 Thread Tom Lane
Adam Rich [EMAIL PROTECTED] writes: Any way to pull the value of a config variable into a pl/pgsql variable? current_setting(), or select from the pg_settings view. regards, tom lane ---(end of broadcast)--- TIP 1: if