Re: [SQL] Request new version to support "on commit drop" for create temp table ... as select ?

2009-07-14 Thread Emi Lu
Got it. Thank you Tom! Scott Marlowe writes: That's what I thought, but create temp table xyz as select * from abc on commit drop; still fails on 8.3. Was this fixed in 8.4 or is my syntax wonky? Your syntax is wonky -- switch the clause order. http://www.postgresql.org/docs/8.3/stati

Re: [SQL] Request new version to support "on commit drop" for create temp table ... as select ?

2009-07-14 Thread Tom Lane
Scott Marlowe writes: > That's what I thought, but > create temp table xyz as select * from abc on commit drop; > still fails on 8.3. Was this fixed in 8.4 or is my syntax wonky? Your syntax is wonky -- switch the clause order. http://www.postgresql.org/docs/8.3/static/sql-createtableas.html

Re: [SQL] Request new version to support "on commit drop" for create temp table ... as select ?

2009-07-14 Thread Scott Marlowe
On Tue, Jul 14, 2009 at 10:47 AM, Tom Lane wrote: > Emi Lu writes: >> I googled to find that "on commit drop" does not support: > >> (a) create temp table as select * from table1 where 1<>2; >> http://archives.postgresql.org/pgsql-sql/2005-09/msg00153.php > > Ah, the pitfalls of believing that the

Re: [SQL] Request new version to support "on commit drop" for create temp table ... as select ?

2009-07-14 Thread Tom Lane
Emi Lu writes: > I googled to find that "on commit drop" does not support: > (a) create temp table as select * from table1 where 1<>2; > http://archives.postgresql.org/pgsql-sql/2005-09/msg00153.php Ah, the pitfalls of believing that the first google hit you get is authoritative. Didn't you not

[SQL] Request new version to support "on commit drop" for create temp table ... as select ?

2009-07-14 Thread Emi Lu
Good morning, I googled to find that "on commit drop" does not support: (a) create temp table as select * from table1 where 1<>2; http://archives.postgresql.org/pgsql-sql/2005-09/msg00153.php If table1 has complex table structure, grammar(a) will save lots of codes - col1 varchar(1), col2, ...

Re: [SQL] function returning a cursor and a scalar

2009-07-14 Thread Surajit Bhattacharjee
Thanks much Alvaro. Didn't know I could do that. For returning the matches, I am planning to run a separate count(*) query with the original WHERE clause minus joins that are purely for pulling addnl attributes from related entities. Only if this query returns a positive count, I will run the quer