Re: Anything akin to an Evaluate Statement in Postgresql?

From: A E <cooljoint(at)yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Anything akin to an Evaluate Statement in Postgresql?
Date: 2004-01-06 16:24:24
Message-ID: 20040106162424.9900.qmail@web12102.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

objectdefinition is defined as a record variable. It works fine when I remove the statement trying to get the dynamically concocted string executed and the results placed into the aliasvalue variable which is varchar.

My first question is, Can you perform a select on a variable? Such as in the case of executing the dynamic string of objectdefinition.[Whatever Value]

My next question is do you have declare the variable being used in a for in execute as a record variable? If so is this by design or limitation?

My last question is has anyone else run into this before? Where the name of the column was unknown, and it was dynamically generated and needed to be turned into a reference instead of a string?

TIA

Alex

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
A E writes:
> I tried to use a for in loop to execute the statement to try to get some dynamic functionality but I get "ERROR: missing ".." at end of SQL expression" what am I doing wrong?

Did you declare the loop variable (here, "objectdefinition") as a
record or rowtype variable? If the loop variable is not known,
plpgsql assumes this is a locally-declared-integer kind of FOR loop,
which leads it to expect the lowbound .. highbound kind of syntax,
which leads to the above error message.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2004-01-06 17:11:50 Re: Paypal WAS: PostgreSQL speakers needed for OSCON 2004
Previous Message Tom Lane 2004-01-06 15:56:59 Re: Anything akin to an Evaluate Statement in Postgresql?