pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Create table doesn't work in plpgsql
8+ messages / 6 participants
[nested] [flat]

* Create table doesn't work in plpgsql
@ 2000-12-19 17:54 Volker Paul <vpaul@dohle.com>
  2000-12-19 21:58 ` Re: Create table doesn't work in plpgsql Jie Liang <jliang@jliang.ipinc.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Volker Paul @ 2000-12-19 17:54 UTC (permalink / raw)
  To: pgsql-sql

Hi,

can I do some table manipulation in plpgsql?
Look at only the "create table" line and the error message:

create function plural (text) returns text as '
   begin 
   create table tmp (num int4); 
   return $1 || ''s''; 
   end;' language 'plpgsql'; 
select plural('test'); 
CREATE
ERROR:  copyObject: don't know how to copy 611

What does the error message mean? Where can I read more about it?

Cheers, Volker



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Create table doesn't work in plpgsql
  2000-12-19 17:54 Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
@ 2000-12-19 21:58 ` Jie Liang <jliang@jliang.ipinc.com>
  2000-12-21 10:51   ` Re: Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Jie Liang @ 2000-12-19 21:58 UTC (permalink / raw)
  To: Volker Paul <vpaul@dohle.com>; +Cc: pgsql-sql

Hi,there,

I don't think you can use DDL(data definition language) in PL/SQL.
create table is not DML(data munipulation language) instead
it's a DDL. 

Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com

On Tue, 19 Dec 2000, Volker Paul wrote:

> Hi,
> 
> can I do some table manipulation in plpgsql?
> Look at only the "create table" line and the error message:
> 
> create function plural (text) returns text as '
>    begin 
>    create table tmp (num int4); 
>    return $1 || ''s''; 
>    end;' language 'plpgsql'; 
> select plural('test'); 
> CREATE
> ERROR:  copyObject: don't know how to copy 611
> 
> What does the error message mean? Where can I read more about it?
> 
> Cheers, Volker
> 




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Create table doesn't work in plpgsql
  2000-12-19 17:54 Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
  2000-12-19 21:58 ` Re: Create table doesn't work in plpgsql Jie Liang <jliang@jliang.ipinc.com>
@ 2000-12-21 10:51   ` Volker Paul <vpaul@dohle.com>
  2000-12-21 15:54     ` Re: Create table doesn't work in plpgsql Mike Castle <dalgoda@ix.netcom.com>
  2000-12-21 17:10     ` Re: Create table doesn't work in plpgsql Stephan Szabo <sszabo@megazone23.bigpanda.com>
  2000-12-21 18:20     ` Re: Create table doesn't work in plpgsql Jie Liang <jliang@ipinc.com>
  0 siblings, 3 replies; 8+ messages in thread

From: Volker Paul @ 2000-12-21 10:51 UTC (permalink / raw)
  To: pgsql-sql

Hi,

> I don't think you can use DDL(data definition language) in PL/SQL.
> create table is not DML(data munipulation language) instead
> it's a DDL.
Thanks, but that leaves me with a problem.
What I really want to do is something like
select str from person where id=1234;
where str is a string that contains an expression like 
famname || ', ' || givname
i.e. the final select is 
select famname || ', ' || givname from person where id=1234;
I know it's possible by building the select e.g. in bash
and calling psql with it as an argument, but do you see a possibility
that is closer to Postgres, e.g. in plpgsql?


Volker Paul



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Create table doesn't work in plpgsql
  2000-12-19 17:54 Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
  2000-12-19 21:58 ` Re: Create table doesn't work in plpgsql Jie Liang <jliang@jliang.ipinc.com>
  2000-12-21 10:51   ` Re: Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
@ 2000-12-21 15:54     ` Mike Castle <dalgoda@ix.netcom.com>
  2000-12-22 13:00       ` Re: Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
  2000-12-24 03:44       ` Re: Create table doesn't work in plpgsql Keith Wong <keith@e-magine.com.au>
  2 siblings, 2 replies; 8+ messages in thread

From: Mike Castle @ 2000-12-21 15:54 UTC (permalink / raw)
  To: pgsql-sql

On Thu, Dec 21, 2000 at 11:51:38AM +0100, Volker Paul wrote:
> select famname || ', ' || givname from person where id=1234;
> I know it's possible by building the select e.g. in bash
> and calling psql with it as an argument, but do you see a possibility
> that is closer to Postgres, e.g. in plpgsql?

Can this be done using tcl or perl?

mrc
-- 
       Mike Castle       Life is like a clock:  You can work constantly
  dalgoda@ix.netcom.com  and be right all the time, or not work at all
www.netcom.com/~dalgoda/ and be right at least twice a day.  -- mrc
    We are all of us living in the shadow of Manhattan.  -- Watchmen



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Create table doesn't work in plpgsql
  2000-12-19 17:54 Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
  2000-12-19 21:58 ` Re: Create table doesn't work in plpgsql Jie Liang <jliang@jliang.ipinc.com>
  2000-12-21 10:51   ` Re: Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
  2000-12-21 15:54     ` Re: Create table doesn't work in plpgsql Mike Castle <dalgoda@ix.netcom.com>
@ 2000-12-22 13:00       ` Volker Paul <vpaul@dohle.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Volker Paul @ 2000-12-22 13:00 UTC (permalink / raw)
  To: pgsql-sql

> Can this be done using tcl or perl?

I'll try them and report what I find out.

V.Paul



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Create table doesn't work in plpgsql
  2000-12-19 17:54 Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
  2000-12-19 21:58 ` Re: Create table doesn't work in plpgsql Jie Liang <jliang@jliang.ipinc.com>
  2000-12-21 10:51   ` Re: Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
  2000-12-21 15:54     ` Re: Create table doesn't work in plpgsql Mike Castle <dalgoda@ix.netcom.com>
@ 2000-12-24 03:44       ` Keith Wong <keith@e-magine.com.au>
  1 sibling, 0 replies; 8+ messages in thread

From: Keith Wong @ 2000-12-24 03:44 UTC (permalink / raw)
  To: Volker Paul <vpaul@dohle.com>; pgsql-sql

I believe a couple of months back... a EXECUTE command was added to plpgsql 
to allow users to dynamic sql statements.

So if you get the current development version you should be able to call

EXECUTE CREATE TABLE ....

or whatever sql you like. (I think this is still not in 7.03, not sure though)

I'm not sure about the exact syntax, but if you look in past threads for 
"execute" I'm sure you'll find it.

Have fun.

Merry Xmas.
Keith.

At 02:00 PM 22/12/2000 +0100, Volker Paul wrote:
> > Can this be done using tcl or perl?
>
>I'll try them and report what I find out.
>
>V.Paul




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Create table doesn't work in plpgsql
  2000-12-19 17:54 Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
  2000-12-19 21:58 ` Re: Create table doesn't work in plpgsql Jie Liang <jliang@jliang.ipinc.com>
  2000-12-21 10:51   ` Re: Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
@ 2000-12-21 17:10     ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
  2 siblings, 0 replies; 8+ messages in thread

From: Stephan Szabo @ 2000-12-21 17:10 UTC (permalink / raw)
  To: Volker Paul <vpaul@dohle.com>; +Cc: pgsql-sql


I believe (although I haven't tried it) that pltcl will allow
you to do things such as this.

On Thu, 21 Dec 2000, Volker Paul wrote:

> Hi,
> 
> > I don't think you can use DDL(data definition language) in PL/SQL.
> > create table is not DML(data munipulation language) instead
> > it's a DDL.
> Thanks, but that leaves me with a problem.
> What I really want to do is something like
> select str from person where id=1234;
> where str is a string that contains an expression like 
> famname || ', ' || givname
> i.e. the final select is 
> select famname || ', ' || givname from person where id=1234;
> I know it's possible by building the select e.g. in bash
> and calling psql with it as an argument, but do you see a possibility
> that is closer to Postgres, e.g. in plpgsql?




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Create table doesn't work in plpgsql
  2000-12-19 17:54 Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
  2000-12-19 21:58 ` Re: Create table doesn't work in plpgsql Jie Liang <jliang@jliang.ipinc.com>
  2000-12-21 10:51   ` Re: Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
@ 2000-12-21 18:20     ` Jie Liang <jliang@ipinc.com>
  2 siblings, 0 replies; 8+ messages in thread

From: Jie Liang @ 2000-12-21 18:20 UTC (permalink / raw)
  To: Volker Paul <vpaul@dohle.com>; +Cc: pgsql-sql


Hi,there,

I am not quite sure what you try to do.
However, plpgsql allows you use any DDL, most of functions defined and
sql operators.
I don't see the problem.

Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com

On Thu, 21 Dec 2000, Volker Paul wrote:

> Hi,
> 
> > I don't think you can use DDL(data definition language) in PL/SQL.
> > create table is not DML(data munipulation language) instead
> > it's a DDL.
> Thanks, but that leaves me with a problem.
> What I really want to do is something like
> select str from person where id=1234;
> where str is a string that contains an expression like 
> famname || ', ' || givname
> i.e. the final select is 
> select famname || ', ' || givname from person where id=1234;
> I know it's possible by building the select e.g. in bash
> and calling psql with it as an argument, but do you see a possibility
> that is closer to Postgres, e.g. in plpgsql?
> 
> 
> Volker Paul
> 




^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2000-12-24 03:44 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-12-19 17:54 Create table doesn't work in plpgsql Volker Paul <vpaul@dohle.com>
2000-12-19 21:58 ` Jie Liang <jliang@jliang.ipinc.com>
2000-12-21 10:51   ` Volker Paul <vpaul@dohle.com>
2000-12-21 15:54     ` Mike Castle <dalgoda@ix.netcom.com>
2000-12-22 13:00       ` Volker Paul <vpaul@dohle.com>
2000-12-24 03:44       ` Keith Wong <keith@e-magine.com.au>
2000-12-21 17:10     ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2000-12-21 18:20     ` 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