Re: [GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-15 Thread Alexander Farber
Thank you Misa, the without-temp-tables query has worked flawlessly. On Wed, Jun 13, 2012 at 5:01 PM, Misa Simic wrote: > I think you can have all in one query, without temp tables: > >  SELECT r.rid, r.cards, to_char(r.stamp, 'DD.MM. > HH24:MI') as day, >                    c.bid, c.trix, c

Re: [GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Misa Simic
I agree with approach to have all in functions... In that case there would not be a problem with temp tables because of inside 1 transaction they would work... suggestion was just to solve problem from php... what would be achiavable just trough 1 query, or to use PDO and then: $dbh->beginTransac

Re: [GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Leif Biberg Kristensen
Onsdag 13. juni 2012 15.12.33 skrev Alexander Farber : > Any ideas please on how to handle this situation > in PHP scripts, do I really have to encapsulate > my calls into a pl/PgSQL function? I believe that Misa Simic's idea that you can do it all in a single query without temp tables is corre

Re: [GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Misa Simic
Hi Alexander, I think you can have all in one query, without temp tables: SELECT r.rid, r.cards, to_char(r.stamp, 'DD.MM. HH24:MI') as day, c.bid, c.trix, c.pos, c.money, c.last_ip, c.quit, u.id, u.first_name, u.avatar, u.female, u.city, u.vip > CURRENT_

Re: [GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Alban Hertroys
On 13 June 2012 15:12, Alexander Farber wrote: > And when I split my statements into multiple > prepare()/execute() or query() calls, > then the temp. tables aren't found anymore. Did you remember to wrap them in a transaction like you did in your prepared statement? -- If you can't see the for

[GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Alexander Farber
Hello fello PostgreSQL users, with PHP 5.3.3 and PostgreSQL 8.4.11 (and a pgbouncer, but I've tried without it too) I'm trying to execute several SQL queries with 2 temp tables (listed below) and then use the result of a final join to construct a JSON array. Unfortunately my script using prepare/