Re: Passing a table name to a function for dynamic queries....

From: Richard Huxton <dev(at)archonet(dot)com>
To: Greg Patnude <gpatnude(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Passing a table name to a function for dynamic queries....
Date: 2005-06-29 18:37:15
Message-ID: 42C2EA5B.6050804@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greg Patnude wrote:
> I know I've seen the answer to this here before but cannot seem to find
> it.... Can anyone give me the quick & dirty answer to passing a table name
> to a function like this:
>
> CREATE OR REPLACE FUNCTION tbl_toarray(name) RETURNS text

Build the query as text and use EXECUTE to run it.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2005-06-29 18:51:00 Re: Need help writing SQL statement
Previous Message Devrim GUNDUZ 2005-06-29 18:31:55 Re: CVS Build - No Doc