Re: [GENERAL] Means to emulate global temporary table

2017-01-12 Thread Ian Lewis
On Wed, Jan 11, 2017 at 5:36 PM, Adrian Klaver wrote: > > So what is the relationship of clients to sessions? Most of our client applications use one session. But, a few use multiple sessions, largely to support threaded access to the database. In our current setup, a session connection may only

Re: [GENERAL] Means to emulate global temporary table

2017-01-12 Thread Adrian Klaver
On 01/12/2017 12:37 AM, George Neuner wrote: On Wed, 11 Jan 2017 15:23:10 -0800, John R Pierce wrote: On 1/11/2017 2:07 PM, Ian Lewis wrote: I am working on porting from an SQL Anywhere server that has support for general temporary tables. It appears that PostgreSQL does not have such support

Re: [GENERAL] Means to emulate global temporary table

2017-01-12 Thread Berend Tober
Karsten Hilbert wrote: On Wed, Jan 11, 2017 at 05:54:11PM -0700, David G. Johnston wrote: I don't see where "call a setup function immediately after connecting" Sounds like a "login trigger", more generally an ON CONNECT event trigger, which we don't have at the moment as far as I know. One

Re: [GENERAL] Means to emulate global temporary table

2017-01-12 Thread Pavel Stehule
Hi 2017-01-12 10:06 GMT+01:00 Karsten Hilbert : > On Wed, Jan 11, 2017 at 05:54:11PM -0700, David G. Johnston wrote: > > > I don't see where "call a setup function immediately after connecting" > > Sounds like a "login trigger", more generally an ON CONNECT > event trigger, which we don't have at

Re: [GENERAL] Means to emulate global temporary table

2017-01-12 Thread Karsten Hilbert
On Wed, Jan 11, 2017 at 05:54:11PM -0700, David G. Johnston wrote: > I don't see where "call a setup function immediately after connecting" Sounds like a "login trigger", more generally an ON CONNECT event trigger, which we don't have at the moment as far as I know. One of the main arguments aga

Re: [GENERAL] Means to emulate global temporary table

2017-01-12 Thread George Neuner
On Wed, 11 Jan 2017 15:23:10 -0800, John R Pierce wrote: >On 1/11/2017 2:07 PM, Ian Lewis wrote: >> I am working on porting from an SQL Anywhere server that has support >> for general temporary tables. It appears that PostgreSQL does not have >> such support. > >postgres temporary tables are ei

Re: [GENERAL] Means to emulate global temporary table

2017-01-11 Thread Steve Atkins
> On Jan 11, 2017, at 7:02 PM, David G. Johnston > wrote: > > ​"throughout" mustn't mean "by other sessions" or this becomes unwieldy. > > Here's a mock-up: > > CREATE TABLE template_table (); > CREATE VIEW view_over_my_template_instance AS SELECT * FROM > my_instance_of_template_table; --fa

Re: [GENERAL] Means to emulate global temporary table

2017-01-11 Thread David G. Johnston
On Wed, Jan 11, 2017 at 7:51 PM, John R Pierce wrote: > On 1/11/2017 6:39 PM, Ian Lewis wrote: > >> Does this mean that a local temporary table created in one function in a >> database is visible globally throughout the database for the duration of >> the session? >> > > postgres temporary tables

Re: [GENERAL] Means to emulate global temporary table

2017-01-11 Thread John R Pierce
On 1/11/2017 6:39 PM, Ian Lewis wrote: Does this mean that a local temporary table created in one function in a database is visible globally throughout the database for the duration of the session? postgres temporary tables are only visible to the session that creates them. all kind of w

Re: [GENERAL] Means to emulate global temporary table

2017-01-11 Thread David G. Johnston
On Wed, Jan 11, 2017 at 7:39 PM, Ian Lewis wrote: > On Wed, Jan 11, 2017 at 4:54 PM, David G. Johnston < >> david.g.johns...@gmail.com> wrote: >> >>> > ​The way I read this is that the OP wants to be able to write >>> functions that target temporary tables. These functions all assume that >>> sa

Re: [GENERAL] Means to emulate global temporary table

2017-01-11 Thread Ian Lewis
On Wed, Jan 11, 2017 at 4:38 PM, Adrian Klaver wrote: So what makes them temporary as they seem to persist between sessions? They are temporary in the sense that the content of the table is per-session, just as a local temporary table would be. That is, each session has its own independent data

Re: [GENERAL] Means to emulate global temporary table

2017-01-11 Thread Ian Lewis
> > On Wed, Jan 11, 2017 at 4:54 PM, David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> > ​The way I read this is that the OP wants to be able to write functions >> that target temporary tables. These functions all assume that said tables >> already exist so the functions themselves do

Re: [GENERAL] Means to emulate global temporary table

2017-01-11 Thread Adrian Klaver
On 01/11/2017 05:30 PM, Ian Lewis wrote: Ccing list On Wed, Jan 11, 2017 at 4:38 PM, Adrian Klaver mailto:adrian.kla...@aklaver.com>> wrote: So what makes them temporary as they seem to persist between sessions? They are temporary in the sense that the content of the table is per-session,

Re: [GENERAL] Means to emulate global temporary table

2017-01-11 Thread David G. Johnston
On Wed, Jan 11, 2017 at 5:38 PM, Adrian Klaver wrote: > Because the tables are known, many different functions can access the >> same tables during a session to manipulate the result set. And, because >> the tables are global the client can see the results easily based on the >> then-current tabl

Re: [GENERAL] Means to emulate global temporary table

2017-01-11 Thread Adrian Klaver
On 01/11/2017 02:07 PM, Ian Lewis wrote: I am working on porting from an SQL Anywhere server that has support for general temporary tables. It appears that PostgreSQL does not have such support. We use global temporary tables as a means to provide session-local content to clients based on calcul

Re: [GENERAL] Means to emulate global temporary table

2017-01-11 Thread John R Pierce
On 1/11/2017 2:07 PM, Ian Lewis wrote: I am working on porting from an SQL Anywhere server that has support for general temporary tables. It appears that PostgreSQL does not have such support. postgres temporary tables are either local to a transaction, or to a connection/session, and are aut