Search Postgresql Archives

Re: create temp in function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



am  Mon, dem 21.04.2008, um 15:22:52 -0600 mailte Kerri Reno folgendes:
> But if I create and run the following function, it bombs on the second run.  It
> gives me:
> compassdevel_lb=# select testtemp();
> NOTICE:  relid: 186270497
> NOTICE:  count: 0
>  testtemp
> ----------
>  t
> (1 row)
> 
> compassdevel_lb=# select testtemp();
> NOTICE:  relid: <NULL>
> ERROR:  relation with OID 186270497 does not exist
> CONTEXT:  SQL statement "SELECT  count(*) from schedrec"
> PL/pgSQL function "testtemp" line 9 at select into variables
> 
> Here is my function:
> create or replace function testtemp()
>     returns boolean as
> $body$
> declare
>     query text;
>     relid integer;
>     cnt integer;
> begin
>     create temp table schedrec (sch text, cl text, st text);


Use EXECUTE for DDL-Statements within function, because the planner
cached the OID's.

Other solution: use 8.3.

More details about that:
http://merlinmoncure.blogspot.com/2007/09/as-previously-stated-postgresql-8.html

Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux