Re: Problem with temporary tables - Mailing list pgsql-general

From Andrea Lombardoni
Subject Re: Problem with temporary tables
Date
Msg-id AANLkTikiMqbctuDHRL0deLbrqNTi765ElD-B9xEedxW4@mail.gmail.com
Whole thread Raw
In response to Re: Problem with temporary tables  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: Problem with temporary tables  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Re: Problem with temporary tables  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general
> You need to use EXECUTE for the INSERT statement as well per error:
>
> CONTEXT:  SQL statement "INSERT INTO idmap (oldid, type, newid) VALUES(1,
>  1, 1)" PL/pgSQL function "test" line 16 at SQL statement

Thanks, this works and solves my problem.

Still, I find this behaviour to be rather quirky.

Ideally the generated query plan should notice such cases and either
report an error or use the version of the temporary table currently
'live'.

At least this quirk should be highlighted both in the plpgsql
documentation page
http://www.postgresql.org/docs/8.2/interactive/plpgsql-overview.html
and linked from the CREATE TABLE page
http://www.postgresql.org/docs/8.2/interactive/sql-createtable.html

I will propose these changes in the appropriate mailing lists.

Have a nice day!

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Problem with temporary tables
Next
From: Grzegorz Jaśkiewicz
Date:
Subject: Re: Problem with temporary tables