pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Seethalakshmi VB <seethalakshmi.vb@majoris.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Creating tables from within functions
Date: Tue, 28 Jan 2003 22:44:57 -0800 (PST)
Message-ID: <20030128224307.H4312-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <MCBBKKFNMOLJEPPNKICGCEABCAAA.seethalakshmi.vb@majoris.com>


On Fri, 24 Jan 2003, Seethalakshmi VB wrote:

> Is it possible to issue a CREATE TABLE statement from inside of a PostgreSQL
> function?  If not, then how about from within a PL/pgSQL function?  I have
> tried a lot of different permutations but can't seem to get it to compile
> and/or run cleanly.  For example, consider:
>
> 	CREATE FUNCTION _testcreate () RETURNS text AS '
> 	BEGIN
> 		CREATE TABLE switch_table2 (switch_id varchar(32),
> selection_name varchar(100));
> 	end;
> 	' language 'plpgsql';
>
> What is wrong with this?  What type should be returned?  Or perhaps it is

Well you have no return value.  Once I put one in it works for me.




view thread (4+ messages)  latest in thread

Message-ID: <20030128224307.H4312-100000@megazone23.bigpanda.com>
Permalink:  ../20030128224307.H4312-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20030128224307.H4312-100000@megazone23.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone23.bigpanda.com, seethalakshmi.vb@majoris.com
  Subject: Re: Creating tables from within functions
  In-Reply-To: <20030128224307.H4312-100000@megazone23.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox