vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I want to write a contrib module that exports a couple of functions that PLs (that don't natively support this) can use to set/get session-local variables. I have a couple of questions: - Can I simply use a global variable for my hash? Am I correct in thinking that stored procedures and functions will be executed in the postgres process assigned to the connection that invokes them, and therefore each will have its own copy of the global variable? - How can I get a session-scoped MemoryContext to allocate nodes out of? Thanks, Nick Johnson ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org/ |
| |||
| "Nick Johnson" <arachnid@notdot.net> writes: > I want to write a contrib module that exports a couple of functions > that PLs (that don't natively support this) can use to set/get > session-local variables. Um, why do you need to do anything? Don't current_setting() and set_config() cover this? regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org/ |
| |||
| On 7/2/07, Tom Lane <tgl@sss.pgh.pa.us> wrote: > "Nick Johnson" <arachnid@notdot.net> writes: > > I want to write a contrib module that exports a couple of functions > > that PLs (that don't natively support this) can use to set/get > > session-local variables. > > Um, why do you need to do anything? Don't current_setting() and > set_config() cover this? I thought those were supposed to be reserved for postgres's configuration options? -Nick Johnson ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq |
| ||||
| "Nick Johnson" <arachnid@notdot.net> writes: > On 7/2/07, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> "Nick Johnson" <arachnid@notdot.net> writes: >>> I want to write a contrib module that exports a couple of functions >>> that PLs (that don't natively support this) can use to set/get >>> session-local variables. >> >> Um, why do you need to do anything? Don't current_setting() and >> set_config() cover this? > I thought those were supposed to be reserved for postgres's > configuration options? Oh, you meant arbitrary new variables. You can (ab)use custom_variable_classes for that. I've also seen people do it with plperl or pltcl, using those languages' inbuilt capacity for process-lifetime variables. (Probably plpython can do it too, but I'm mostly clueless wrt python.) Anyway, there are multiple ways to do this with just a couple lines of code, so I don't see a need for a contrib module. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend |
| Thread Tools | |
| Display Modes | |
|
|