Re: create a table inside a function - Mailing list pgsql-general

From hubert depesz lubaczewski
Subject Re: create a table inside a function
Date
Msg-id 20090625130748.GA24456@depesz.com
Whole thread Raw
In response to create a table inside a function  (Alain Roger <raf.news@gmail.com>)
List pgsql-general
On Thu, Jun 25, 2009 at 02:53:59PM +0200, Alain Roger wrote:
> i would like to execute the following SQL command into a function based on
> some IF, END IF tests before.
> how can i do that ?

1. you can use execute in pl/pgsql.
2. if your ifs are basically testing if the table exists - you might
want to check this:
http://www.depesz.com/index.php/2008/06/18/conditional-ddl/

Best regards,

depesz

--
Linkedin: http://www.linkedin.com/in/depesz  /  blog: http://www.depesz.com/
jid/gtalk: depesz@depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

pgsql-general by date:

Previous
From: Greg Stark
Date:
Subject: Re: [BUGS] Integrity check
Next
From: Alain Roger
Date:
Subject: Re: create a table inside a function