Re: Sharing data between stored functions?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Igor Neyman <ineyman(at)perceptron(dot)com>, inspector morse <inspectormorse86(at)gmail(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sharing data between stored functions?
Date: 2015-03-05 18:53:24
Message-ID: 54F8A624.3020209@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/05/2015 07:48 AM, Igor Neyman wrote:
>
>
> From: inspector morse [mailto:inspectormorse86(at)gmail(dot)com]
> Sent: Thursday, March 05, 2015 10:37 AM
> To: Adrian Klaver
> Cc: Merlin Moncure; Igor Neyman; pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Sharing data between stored functions?
>
> I'm confused with what Igor said. He said to create the temporary table with "on commit preseve rows" but in the documentation it states that when a session ends (like after each request in a web application when not using persistent connections), the temporary table would automatically be dropped.
> Just to test it, I created the following in a new session:
> CREATE TEMPORARY TABLE http_querystring_values (key TEXT NOT NULL PRIMARY KEY, value TEXT NOT NULL) ON COMMIT DELETE ROWS;
> However, none of the other sessions can find this table. This is correct according to the documentation.
>
> Is there any reason why Postgresql does not implement the SQL standard's version of GLOBAL temporary tables?
> I also don't like the idea of passing the "state" around to functions. I'd rather just query a table OR read some global variable. The JSON /HSTORE syntax looks horrible, I just like to stick with the simplicity of a table.
>
> ----------------------------
> Sorry, my reply was based on (old) Oracle knowledge.
> Now, I'm wondering too, why PG didn't implement such basic (at least to me) feature.

Per my previous post, see:

http://www.postgresql.org/docs/9.4/interactive/sql-createtable.html

Compatibility

The CREATE TABLE command conforms to the SQL standard, with exceptions
listed below.

Temporary Tables
....
>
> Regards,
> Igor Neyman
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Igor Neyman 2015-03-05 19:01:12 Re: Sharing data between stored functions?
Previous Message Tim Semmelhaack 2015-03-05 16:35:29 Re: Copy Data between different databases