Received: from woody.aiinet.com (mail1.aiinet.com [38.195.69.30]) by hub.org (8.10.1/8.10.1) with ESMTP id e5RGFd181132 for ; Tue, 27 Jun 2000 12:15:44 -0400 (EDT) Received: by mail2.aiinet.com with Internet Mail Service (5.5.2650.21) id ; Tue, 27 Jun 2000 12:17:29 -0400 Message-ID: <7283DE19D141D111AD0E00A0C95B195502488A93@mail2.aiinet.com> From: "Saltsgaver, Scott" To: "Pgsql-Sql (E-mail)" Subject: Creating tables from within functions Date: Tue, 27 Jun 2000 12:17:20 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" X-Archive-Number: 200006/240 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