Re: [GENERAL] Temp table visibility

2011-08-05 Thread Andrew Sullivan
On Fri, Aug 05, 2011 at 10:55:08AM -0400, Tom Lane wrote: > Also, you can change the priority if you have a mind to, by adding > "pg_temp" to the search_path explicitly, for example Hey, that's cool, and it never occurred to me. The current text in the 9.0 manual says this: Likewise, the cur

Re: [GENERAL] Temp table visibility

2011-08-05 Thread Tom Lane
Andrew Sullivan writes: > On Fri, Aug 05, 2011 at 08:35:37AM -0400, JJ wrote: >> I was recently looking at the way "create temp table as" works and the >> manual specifies that temp tables given the same name as an existing table >> will be used instead of the permanent table. It also states th

Re: [GENERAL] Temp table visibility

2011-08-05 Thread Andrew Sullivan
On Fri, Aug 05, 2011 at 08:35:37AM -0400, JJ wrote: > Hello all, > > I was recently looking at the way "create temp table as" works and the manual > specifies that temp tables given the same name as an existing table will be > used instead of the permanent table. It also states that the permane

[GENERAL] Temp table visibility

2011-08-05 Thread JJ
Hello all, I was recently looking at the way "create temp table as" works and the manual specifies that temp tables given the same name as an existing table will be used instead of the permanent table. It also states that the permanent table can be accessed via its schema-qualified name. I ma

Re: [GENERAL] Temp table or normal table for performance?

2009-08-21 Thread Grzegorz Jaƛkiewicz
On Thu, Aug 20, 2009 at 2:43 PM, Jasen Betts wrote: > On 2009-08-19, Stephen Cook wrote: > >> Let's say I have a function that needs to collect some data from various >> tables and process and sort them to be returned to the user. > > plpgsql functions don't play well with temp tables IME. > there

Re: [GENERAL] Temp table or normal table for performance?

2009-08-21 Thread Ivan Sergio Borgonovo
On 20 Aug 2009 13:43:10 GMT Jasen Betts wrote: > On 2009-08-19, Stephen Cook wrote: > > > Let's say I have a function that needs to collect some data from > > various tables and process and sort them to be returned to the > > user. > > plpgsql functions don't play well with temp tables IME. W

Re: [GENERAL] Temp table or normal table for performance?

2009-08-20 Thread Martijn van Oosterhout
On Wed, Aug 19, 2009 at 03:03:28AM -0400, Stephen Cook wrote: > Let's say I have a function that needs to collect some data from various > tables and process and sort them to be returned to the user. > > In general, would it be better to create a temporary table in that > function, do the work

Re: [GENERAL] Temp table or normal table for performance?

2009-08-20 Thread Jasen Betts
On 2009-08-19, Stephen Cook wrote: > Let's say I have a function that needs to collect some data from various > tables and process and sort them to be returned to the user. plpgsql functions don't play well with temp tables IME. there are work-arounds and they are ugly. if you caus use a differ

Re: [GENERAL] Temp table or normal table for performance?

2009-08-20 Thread Sam Mason
On Wed, Aug 19, 2009 at 08:10:14PM -0400, Stephen Cook wrote: > I've decided on some type of table storage because basically I'm > combining information from several different tables (some of which need > to recursively get other rows) and massaging it and sorting it in ways > far too convoluted

Re: [GENERAL] Temp table or normal table for performance?

2009-08-19 Thread Stephen Cook
Peter Hunsberger wrote: On Wed, Aug 19, 2009 at 2:03 AM, Stephen Cook wrote: Let's say I have a function that needs to collect some data from various tables and process and sort them to be returned to the user. In general, would it be better to create a temporary table in that function, do the

[GENERAL] Temp table or normal table for performance?

2009-08-19 Thread Stephen Cook
Let's say I have a function that needs to collect some data from various tables and process and sort them to be returned to the user. In general, would it be better to create a temporary table in that function, do the work and sorting there, and return it... or keep a permanent table for prett

Re: [GENERAL] temp table in 8.3

2008-02-19 Thread Scott Marlowe
On Feb 19, 2008 10:37 PM, serafin segador <[EMAIL PROTECTED]> wrote: > > hello list, > > i am a newbie in postgresql. Why are you posting the same request twice? > i ported a small application to postgresql 8.2 originally written to store > data in maxdb. since stored procedures are not supporte

[GENERAL] temp table in 8.3

2008-02-19 Thread serafin segador
hello list, i am a newbie in postgresql. i ported a small application to postgresql 8.2 originally written to store data in maxdb. since stored procedures are not supported in postgresql and since postgresql functions cannot return cursor to the calling applications, i rewrote the maxdb

Re: [GENERAL] temp table question

2008-02-01 Thread Scott Marlowe
On Feb 1, 2008 9:06 PM, Kevin Kempter <[EMAIL PROTECTED]> wrote: > Hi list; > > If I create a temp table (i.e. create temp table xyz as select from ...) is > the scope of this table limited to a session. Meaning, can several sessions > all run the above create temp table statement all referencing

Re: [GENERAL] temp table question

2008-02-01 Thread brian
Kevin Kempter wrote: Hi list; If I create a temp table (i.e. create temp table xyz as select from ...) is the scope of this table limited to a session. Meaning, can several sessions all run the above create temp table statement all referencing the same temp table name at the same time? Yes

[GENERAL] temp table question

2008-02-01 Thread Kevin Kempter
Hi list; If I create a temp table (i.e. create temp table xyz as select from ...) is the scope of this table limited to a session. Meaning, can several sessions all run the above create temp table statement all referencing the same temp table name at the same time? Thanks in advance ---

Re: [GENERAL] Temp Table

2007-10-19 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/19/07 11:39, Bob Pawley wrote: > When I fetch a row, as in the following, how do I copy the row's data into a > temporary table so that I can process it?? > > begin work; > Declare loop_set Cursor >for Select one, two, three,

[GENERAL] Temp Table

2007-10-19 Thread Bob Pawley
When I fetch a row, as in the following, how do I copy the row's data into a temporary table so that I can process it?? begin work; Declare loop_set Cursor for Select one, two, three, four, five, six, seven from loop_import order by loop_id ; fetch next From loop_set

Re: [GENERAL] Temp Table Within PLPGSQL Function - Something Awry

2007-01-16 Thread Chad Wagner
It appears that what is happening is PL/pgSQL is caching the table definition (it appears to do this on first execution), testing it with dynamic SQL via the EXECUTE clause doesn't exhibit the same issue: CREATE OR REPLACE FUNCTION test_fxn() RETURNS SETOF RECORD AS $$ DECLARE test_rec RECORD;

Re: [GENERAL] Temp Table Within PLPGSQL Function - Something Awry

2007-01-16 Thread Alan Hodgson
On Tuesday 16 January 2007 10:10, "Lenorovitz, Joel" <[EMAIL PROTECTED]> wrote: > Greetings, > > I am trying to work with a TEMP TABLE within a plpgsql function and I > was wondering if anyone can explain why the function below, which is > fine syntactically, will work as expected the first time i

Re: [GENERAL] Temp Table Within PLPGSQL Function - Something Awry

2007-01-16 Thread Martijn van Oosterhout
On Tue, Jan 16, 2007 at 11:10:25AM -0700, Lenorovitz, Joel wrote: > Greetings, > > I am trying to work with a TEMP TABLE within a plpgsql function and I > was wondering if anyone can explain why the function below, which is > fine syntactically, will work as expected the first time it is called, >

[GENERAL] Temp Table Within PLPGSQL Function - Something Awry

2007-01-16 Thread Lenorovitz, Joel
Greetings, I am trying to work with a TEMP TABLE within a plpgsql function and I was wondering if anyone can explain why the function below, which is fine syntactically, will work as expected the first time it is called, but will err out as shown on subsequent calls. The DROP TABLE line seems to

[GENERAL] Temp table problem.

2004-04-27 Thread Juris Krumins
SELECT oid,relname FROM pg_class WHERE oid>=1; gives me this output. oid| relname . . . - 125538806 | tmp_table1 . . . 125538808 | pg_toast_125538806 125538810 | pg_toast_125538806_index . .

Re: [GENERAL] temp table::persistance problem

2001-09-29 Thread Keary Suska
Leveraging Open Source for a better Internet" > From: "Emmanuel SARACCO" <[EMAIL PROTECTED]> > Organization: Hub.Org Networking Services (http://www.hub.org) > Reply-To: "Emmanuel SARACCO" <[EMAIL PROTECTED]> > Date: Tue, 25 Sep 2001 16:14:56 +0200 >

[GENERAL] Temp Table In SQL Function

2001-09-07 Thread cnliou
Hello! I am trying to create a sql function that returns 2 values using temporary table as the "media": database1=# CREATE FUNCTION SaveNumeric(int2,int2) RETURNS INTEGER AS ' database1'# CREATE TEMP TABLE mytemp(a int2,b int2); database1'# INSERT INTO mytemp VALUES ($1+1,$2+100); database1'#

Re: [GENERAL] temp table creation

2001-02-14 Thread Tom Lane
Alfonso Peniche <[EMAIL PROTECTED]> writes: > What's wrong with this function? The syntax is supposed to be right, > isn't it? No, it isn't right, not for plpgsql. SELECT INTO means something different to plpgsql than it does in normal Postgres SQL. regards, tom lane

[GENERAL] temp table creation

2001-02-14 Thread Alfonso Peniche
What's wrong with this function? The syntax is supposed to be right, isn't it? Create function UsaTablaTemporal() RETURNS integer AS ' BEGIN SELECT p.apellidos, p.nombres, u.username INTO TEMP TABLE mitabla FROM persona p, usuario u WHERE p.idpersona = u.idusuario