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 misa.si...@gmail.com 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,                    

[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

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 alexander.far...@gmail.com 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? --

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

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

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: