pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Saltsgaver, Scott <scottsa@aiinet.com>
To: Pgsql-Sql (E-mail) <pgsql-sql@postgresql.org>
Subject: Creating tables from within functions
Date: Tue, 27 Jun 2000 12:17:20 -0400
Message-ID: <7283DE19D141D111AD0E00A0C95B195502488A93@mail2.aiinet.com> (raw)

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
simply not possible to create a table from within a function?

Thanks!

Scott Saltsgaver



view thread (4+ messages)  latest in thread

Message-ID: <7283DE19D141D111AD0E00A0C95B195502488A93@mail2.aiinet.com>
Permalink:  ../7283DE19D141D111AD0E00A0C95B195502488A93@mail2.aiinet.com/
Also on:    postgresql.org/message-id/7283DE19D141D111AD0E00A0C95B195502488A93@mail2.aiinet.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: scottsa@aiinet.com
  Subject: Re: Creating tables from within functions
  In-Reply-To: <7283DE19D141D111AD0E00A0C95B195502488A93@mail2.aiinet.com>
  References: <7283DE19D141D111AD0E00A0C95B195502488A93@mail2.aiinet.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