From: | "gary jefferson" <garyjefferson123(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: dynamic table/col names in plpgsql |
Date: | 2007-06-25 15:47:06 |
Message-ID: | 62ad745a0706250847w1af1b4ebk870a0e28371d933b@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks Michael and Steve.
Related question: If I previously had a
IF EXISTS (select ...)
statement, and the 'select ...' part now needs to be run with EXECUTE,
how do I check for existence? It looks like I need to do an 'INTO'
with a row variable? I can't seem to find an example snippet of how
to accomplish this in the pg docs. Where should I be looking?
Thanks again!
Gary
On 6/23/07, Michael Glaesemann <grzm(at)seespotcode(dot)net> wrote:
>
> On Jun 23, 2007, at 22:47 , gary jefferson wrote:
>
> > Is there a way to use a variable as the name of a table or column
> > in plpgsql?
>
> AIUI, you need to use EXECUTE and build the query string yourself.
>
> http://www.postgresql.org/docs/8.2/interactive/plpgsql-
> statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
>
> Take a look at the quote_ident function as well:
>
> http://www.postgresql.org/docs/8.2/interactive/functions-string.html
>
> Hope this helps you get started.
>
> Michael Glaesemann
> grzm seespotcode net
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Jason Long | 2007-06-25 16:01:29 | Automatic install on windows |
Previous Message | Daniel T. Staal | 2007-06-25 15:44:20 | Re: another simple SQL question |