From: | Craig Addleman <CraigA(at)SHARECHIVE(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Pl/tcl auto-load problem |
Date: | 2004-01-29 02:57:47 |
Message-ID: | 21F455F95EFDD411A3E200508BB22B806EB080@sharechive01.sharechive.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
How do I use the pltcu unknown module to auto-load a return value from a
select query? I'm trying to boost performance in our databases by
preloading
certain frequently-used variables. Ultimately I'd like to auto-load
prepared queries this way too.
I've figured out how to use pltcu to auto-load a global variable and access
that variable by appending the following lines to unknown.pltcl:
global var1
set var1 abc
Then, in a pltcu procdure, I can access it:
create function get_var1() returns varchar as '
global var1
return $var1
' language 'pltcu';
(returns abc)
What I'd like to do is something like the following in unknown.pltcl:
global ret
spi_exec "select col1 from tablename where col2 = ''xyz''"
set ret $col1
and return the global $ret in pltcu functions.
When I try use spi_exec in unknown.pltcu, I get an error when loading the
module:
New/updated unknown: too many nested calls to Tcl_EvalObj (infinite
loop?)
Abort
I've tried a few other variations, all without success. Any suggestions?
(I'm
using pltcu because I need a trigger function that can write to system
files, and I don't think that can be done with plperl or plpython.
Performance
boosting through hardware upgrades is not a viable option because the
databases are on tablets running Linux with 245 MB ram and damnably limited
battery life.)
Craig Addleman
DBA
www.sharechive.com
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Atkins | 2004-01-29 03:24:05 | Re: Specifying many rows in a table |
Previous Message | Tom Lane | 2004-01-29 01:33:47 | Re: Specifying many rows in a table |