From: Gerald Gutierrez <pozix(at)home(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject:
Date: 2001-03-04 04:37:42
Message-ID: 5.0.2.1.0.20010303203239.02a139c8@mail.rchmd1.bc.wave.home.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


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.

Responses

  • Re: at 2001-03-05 18:28:55 from Jie Liang

Browse pgsql-sql by date

  From Date Subject
Next Message xuyifeng 2001-03-04 07:15:18 Re: why the DB file size does not reduce when 'delete'the data in DB?
Previous Message Gerald Gutierrez 2001-03-04 04:32:37 Passing table names to PL/PGSQL for SELECT/UPDATE/INSERT