Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 23rd, 2005, 12:29 AM
Mage
Guest
 
Posts: n/a
Default eval in plpgsl

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 majordomo@postgresql.org

  #2  
Old November 23rd, 2005, 12:29 AM
Bruce Momjian
Guest
 
Posts: n/a
Default Re: eval in plpgsl

Mage wrote:[color=blue]
> 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;[/color]

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
pgman@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 majordomo@postgresql.org)

  #3  
Old November 23rd, 2005, 12:29 AM
Mage
Guest
 
Posts: n/a
Default Re: eval in plpgsl

Bruce Momjian wrote:
[color=blue]
>
>Uh, we have EXECUTE, but I don't know if will allow you to set a local
>variable. Maybe you can do:
>
>[/color]
execute doesn't support select into

Mage



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

  #4  
Old November 23rd, 2005, 12:29 AM
Jeff Eckermann
Guest
 
Posts: n/a
Default Re: eval in plpgsl

--- Mage <mage@mage.hu> wrote:[color=blue]
> Bruce Momjian wrote:
>[color=green]
> >
> >Uh, we have EXECUTE, but I don't know if will allow[/color]
> you to set a local[color=green]
> >variable. Maybe you can do:
> >
> >[/color]
> execute doesn't support select into[/color]

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.
[color=blue]
>
> Mage
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: don't forget to increase your free space map[/color]
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

  #5  
Old November 23rd, 2005, 12:29 AM
Jan Wieck
Guest
 
Posts: n/a
Default Re: eval in plpgsl

Bruce Momjian wrote:
[color=blue]
> Mage wrote:[color=green]
>> 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;[/color]
>
> 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
>[/color]

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. #
#================================================= = JanWieck@Yahoo.com #


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles