By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,358 Members | 1,278 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,358 IT Pros & Developers. It's quick & easy.

eval in plpgsl

P: n/a
Hello,

is there any variable variable syntax or function in plpgsql? I didn't
find it.

I mean something like: magic(''new.'' || TG_ARGV[0]) = 5;

Mage

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #1
Share this Question
Share on Google+
4 Replies

P: n/a
Mage wrote:
Hello,

is there any variable variable syntax or function in plpgsql? I didn't
find it.

I mean something like: magic(''new.'' || TG_ARGV[0]) = 5;


Uh, we have EXECUTE, but I don't know if will allow you to set a local
variable. Maybe you can do:

EXECUTE SELECT ''new.''|| TG_ARGV[0] INTO new var

--
Bruce Momjian | http://candle.pha.pa.us
pg***@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #2

P: n/a
Bruce Momjian wrote:

Uh, we have EXECUTE, but I don't know if will allow you to set a local
variable. Maybe you can do:

execute doesn't support select into

Mage

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #3

P: n/a
--- Mage <ma**@mage.hu> wrote:
Bruce Momjian wrote:

Uh, we have EXECUTE, but I don't know if will allow you to set a local
variable. Maybe you can do:

execute doesn't support select into


It does, if you use the "for variablename in execute
...." syntax. Which may seem like overkill for setting
just one value, but at least it will work for you.

Or you could investigate other procedural languages,
which may offer the capability you want. I believe
pltcl does, and perhaps plpython also.

Mage

---------------------------(end of
broadcast)---------------------------
TIP 7: don't forget to increase your free space map

settings
__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway
http://promotions.yahoo.com/design_giveaway/

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #4

P: n/a
Bruce Momjian wrote:
Mage wrote:
Hello,

is there any variable variable syntax or function in plpgsql? I didn't
find it.

I mean something like: magic(''new.'' || TG_ARGV[0]) = 5;


Uh, we have EXECUTE, but I don't know if will allow you to set a local
variable. Maybe you can do:

EXECUTE SELECT ''new.''|| TG_ARGV[0] INTO new var


It does not. This really isn't a full blown scripting language. If one
wants that, there is PL/Tcl.
Jan

--
#================================================= =====================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================= = Ja******@Yahoo.com #
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.