Re: create a table inside a function

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Alain Roger <raf(dot)news(at)gmail(dot)com>
Cc: Frank Heikens <frankygoestorio(at)mac(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: create a table inside a function
Date: 2009-06-25 15:29:33
Message-ID: 20090625152933.GB26253@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alain Roger escribió:

> IF (outResult = 1) THEN
> > return true;
> > ELSE
> > EXECUTE 'create table sw.tmp_import (id serial NOT NULL CONSTRAINT id_key
> > PRIMARY KEY, software VARCHAR(1024), barcode VARCHAR(10), username
> > VARCHAR(1024), area VARCHAR(512), locality VARCHAR(512)) WITH
> > (OIDS=FALSE);';
> > EXECUTE 'ALTER TABLE sw.tmp_import OWNER TO usr_audit';
> > return false;
> > END IF;

Just leave out the EXECUTE and quotes. This example should work without
them.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pedro Doria Meunier 2009-06-25 15:29:39 Re: Upgrade
Previous Message Grzegorz Jaśkiewicz 2009-06-25 15:25:11 Re: Vacuum on the database versus individual tables.