Re: dynamic table/col names in plpgsql - Mailing list pgsql-general

From Michael Glaesemann
Subject Re: dynamic table/col names in plpgsql
Date
Msg-id B3DF8968-0266-443B-82DA-B225D8E08217@seespotcode.net
Whole thread Raw
In response to dynamic table/col names in plpgsql  ("gary jefferson" <garyjefferson123@gmail.com>)
Responses Re: dynamic table/col names in plpgsql
List pgsql-general
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



pgsql-general by date:

Previous
From: "gary jefferson"
Date:
Subject: dynamic table/col names in plpgsql
Next
From: Steve Atkins
Date:
Subject: Re: dynamic table/col names in plpgsql