Re: [GENERAL] [9.0] On temporary tables

2010-10-01 Thread Vincenzo Romano
2010/9/30 Vincenzo Romano : > 2010/9/30 Tom Lane : >> Vincenzo Romano writes: >>> create or replace function session_init() >>> returns void >>> language plpgsql >>> as $body$ >>> declare >>>   t text; >>> begin >>>   select valu into t from session where name='SESSION_ID'; >>>   if not found then

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Lennin Caro
--- On Thu, 9/30/10, Vincenzo Romano wrote: From: Vincenzo Romano Subject: [GENERAL] [9.0] On temporary tables To: "PostgreSQL General" Date: Thursday, September 30, 2010, 11:09 AM Hi all. This is my case: -- begin snippet -- reset search_path; drop table if exists session casca

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Pavel Stehule
2010/9/30 Vincenzo Romano : > 2010/9/30 Pavel Stehule : >> 2010/9/30 Vincenzo Romano : >>> 2010/9/30 Pavel Stehule : Hello >> but if you need a session variables, then you can use a plperl >> >> http://www.postgresql.org/docs/9.0/static/plperl-global.html > > I will look in

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Vincenzo Romano
2010/9/30 Pavel Stehule : > 2010/9/30 Vincenzo Romano : >> 2010/9/30 Pavel Stehule : >>> Hello > but if you need a session variables, then you can use a plperl > > http://www.postgresql.org/docs/9.0/static/plperl-global.html I will look into this. What I need is a set of varia

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Pavel Stehule
2010/9/30 Vincenzo Romano : > 2010/9/30 Pavel Stehule : >> Hello but if you need a session variables, then you can use a plperl http://www.postgresql.org/docs/9.0/static/plperl-global.html >>> >>> I will look into this. What I need is a set of variable for each connection. >>> >> >>

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Vincenzo Romano
2010/9/30 Pavel Stehule : > Hello >>> but if you need a session variables, then you can use a plperl >>> >>> http://www.postgresql.org/docs/9.0/static/plperl-global.html >> >> I will look into this. What I need is a set of variable for each connection. >> > > understand - attention - session variab

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Pavel Stehule
Hello 2010/9/30 Vincenzo Romano : > 2010/9/30 Pavel Stehule : >> Hello >> >> 2010/9/30 Tom Lane : >>> Vincenzo Romano writes: create or replace function session_init() returns void language plpgsql as $body$ declare   t text; begin   select valu into t from

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Vincenzo Romano
2010/9/30 Andy Colson : > On 9/30/2010 8:52 AM, Vincenzo Romano wrote: >> >> I was also thinking about using the catalog, but it looked to me >> "easier" my way. >> And, of course, if you have better advises for a "session variables" >> solution, my ears are open. > > More of a question: why use te

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Grzegorz Jaśkiewicz
you can pass in/out very large set of data inside a transaction by using temp tables. Temporary tables are one of the greatest features of SQL dbs. Here's one fact, it most often takes as long to transfer data from/to a query/function as it takes to execute it. By storing data on the server side, y

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Andy Colson
On 9/30/2010 8:52 AM, Vincenzo Romano wrote: I was also thinking about using the catalog, but it looked to me "easier" my way. And, of course, if you have better advises for a "session variables" solution, my ears are open. More of a question: why use temp tables at all? What does that offer

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Vincenzo Romano
2010/9/30 Pavel Stehule : > Hello > > 2010/9/30 Tom Lane : >> Vincenzo Romano writes: >>> create or replace function session_init() >>> returns void >>> language plpgsql >>> as $body$ >>> declare >>>   t text; >>> begin >>>   select valu into t from session where name='SESSION_ID'; >>>   if not fo

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Pavel Stehule
Hello 2010/9/30 Tom Lane : > Vincenzo Romano writes: >> create or replace function session_init() >> returns void >> language plpgsql >> as $body$ >> declare >>   t text; >> begin >>   select valu into t from session where name='SESSION_ID'; >>   if not found then >>     create temporary table se

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Vincenzo Romano
2010/9/30 Tom Lane : > Vincenzo Romano writes: >> create or replace function session_init() >> returns void >> language plpgsql >> as $body$ >> declare >>   t text; >> begin >>   select valu into t from session where name='SESSION_ID'; >>   if not found then >>     create temporary table session (

Re: [GENERAL] [9.0] On temporary tables

2010-09-30 Thread Tom Lane
Vincenzo Romano writes: > create or replace function session_init() > returns void > language plpgsql > as $body$ > declare > t text; > begin > select valu into t from session where name='SESSION_ID'; > if not found then > create temporary table session ( like public.session including al

[GENERAL] [9.0] On temporary tables

2010-09-30 Thread Vincenzo Romano
Hi all. This is my case: -- begin snippet -- reset search_path; drop table if exists session cascade; create table session ( name text primary key, valu text not null ); create or replace function session_init() returns void language plpgsql as $body$ declare t text; begin select valu into t