pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feed(no subject)
2+ messages / 2 participants
[nested] [flat]
* (no subject)
@ 2001-03-04 04:37 Gerald Gutierrez <pozix@home.com>
0 siblings, 1 reply; 2+ messages in thread
From: Gerald Gutierrez @ 2001-03-04 04:37 UTC (permalink / raw)
To: 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.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re:
@ 2001-03-05 18:28 Jie Liang <jliang@ipinc.com>
parent: Gerald Gutierrez <pozix@home.com>
0 siblings, 0 replies; 2+ messages in thread
From: Jie Liang @ 2001-03-05 18:28 UTC (permalink / raw)
To: Gerald Gutierrez <pozix@home.com>; +Cc: pgsql-sql
Unfortunately, in plsql
you only can do DML(select/update/insert) instead of DDL(create/grant..).
i.e. you cannot create a table in plsql.
Jie LIANG
St. Bernard Software
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
jliang@ipinc.com
www.stbernard.com
www.ipinc.com
On Sat, 3 Mar 2001, Gerald Gutierrez wrote:
>
> 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.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-03-05 18:28 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-03-04 04:37 Gerald Gutierrez <pozix@home.com>
2001-03-05 18:28 ` Re: Jie Liang <jliang@ipinc.com>
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