Received: from mail2.rdc2.bc.home.com (mail2.rdc2.bc.home.com [24.2.10.85]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f244ZJx77244 for ; Sat, 3 Mar 2001 23:35:19 -0500 (EST) (envelope-from pozix@home.com) Received: from elrond.home.com ([24.113.128.171]) by mail2.rdc2.bc.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20010304043511.PLLM585.mail2.rdc2.bc.home.com@elrond.home.com> for ; Sat, 3 Mar 2001 20:35:11 -0800 Message-Id: <5.0.2.1.0.20010303203239.02a139c8@mail.rchmd1.bc.wave.home.com> X-Sender: pozix@mail.rchmd1.bc.wave.home.com X-Mailer: QUALCOMM Windows Eudora Version 5.0.2 Date: Sat, 03 Mar 2001 20:37:42 -0800 To: pgsql-sql@postgresql.org From: Gerald Gutierrez Subject: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Archive-Number: 200103/41 X-Sequence-Number: 1686 I don't seem to be able to create tables (persistent or temporary) from within a PL/PGSQL function. With the following script, I can create the function fine: CREATE FUNCTION tst() RETURNS INTEGER AS ' BEGIN CREATE TABLE ttt(a int); RETURN 0; END; ' LANGUAGE 'plpgsql'; ... but when I execute it , I get the following error. The error happens regardless of whether I use CREATE TABLE or CREATE TEMPORARY TABLE: t1=> \i tst.sql DROP CREATE t1=> select tst(); ERROR: copyObject: don't know how to copy 611 Is it somehow wrong to create tables from within a PL/PGSQL function? Incidently, is it possible to generate a guaranteed unique table name while creating tables, much like some UNICES' ability to generate guaranteed unique file names for tempoary files? Thanks.