Re: pl/pgsql create table

From: Masse Jacques <jacques(dot)masse(at)bordeaux(dot)cemagref(dot)fr>
To: 'Bruce Momjian' <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: pl/pgsql create table
Date: 2002-08-28 08:13:04
Message-ID: 0B87317EA62BD211A02A00A0C9DFB7EC9B5ED2@hermes.bordeaux.cemagref.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Beginner in pgpsql, I have to work a bit to understand all these postings :)

For my own case,
CREATE TABLE mytable AS SELECT * FROM something
works with or without EXECUTE when mytable exists before launching the
function. Both don't work when mytable don't exist.

So, I
CREATE TABLE wk_table (foo int4)
which lives permanently in the database and the function
DROP wk_table
CREATE wk_table with a new structure given by select * from
something

Question : Is it better with EXECUTE and can I use safely this function or
are there some hidden OIDaemons parasiting my database ?

Thanks for all

__________________________________________
Jacques Massé
Tel. 33 (0)5 57 89 08 11 - Fax 33 (0)5 57 89 08 01

-----Message d'origine-----
De : Bruce Momjian [mailto:pgman(at)candle(dot)pha(dot)pa(dot)us]
Envoyé : mardi 27 août 2002 22:01
À : Alvaro Herrera
Cc : Masse Jacques; pgsql-general
Objet : Re: [GENERAL] pl/pgsql create table

I was merely saying that we have multiple problems with compiled-in oids
in plpgsql functions.

---------------------------------------------------------------------------

Alvaro Herrera wrote:
> Bruce Momjian dijo:
>
> >
> > When referencing created/dropped tables in pl/pgsql, use EXECUTE to
> > prevent the table oid from being stored in function as precompiled. It
> > is mentioned in the current FAQ. The solution is for us to
> > automatically add EXECUTE somehow.
>
> I don't understand. I think he is referring to the fact that the
> function aborts midway because the DROP TABLE fails and marks the
> transaction as failed. (but I didn't test before posting)
>
> If that's the case, the solution would be to test for existance of the
> table before the DROP TABLE statement.
>
> >
---------------------------------------------------------------------------
> >
> > Masse Jacques wrote:
>
> > > I have an error when tmp don't exist ( "table tmp don't exist" ...)
> > >
> > > and all is working well when there is a table tmp (no matter the
structure
> > > of this table, the new table has a structure according to foo)
>
> --
> Alvaro Herrera (<alvherre[a]atentus.com>)
> "La gente vulgar solo piensa en pasar el tiempo;
> el que tiene talento, en aprovecharlo"
>
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Browse pgsql-general by date

  From Date Subject
Next Message Barry Lind 2002-08-28 08:16:30 Re: bytea, jdbc, i/o ...
Previous Message Jules Alberts 2002-08-28 07:06:19 Re: How to get a list of procedures and triggers