[GENERAL] Alternative to psql -c ?

2014-06-25 Thread James Le Cuirot
Hello, I've been using the Chef database cookbook and found it frustrating because it doesn't allow you to use peer authentication. The client process generally runs as root and connects to PostgreSQL using the Ruby pg gem. I have patched it to shell out to psql instead. This has the added

Re: [GENERAL] Getting cache lookup failed for aggregate error

2014-06-25 Thread Igor Neyman
FWIW the SQL is DROP AGGREGATE IF EXISTS array_cat_aggregate(anyarray); CREATE AGGREGATE array_cat_aggregate(anyarray) ( SFUNC = array_cat, STYPE = anyarray, INITCOND = '{}' ); Followed by the other statement given in my previous email. But, I think you've thoroughly

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread James Le Cuirot
On Wed, 25 Jun 2014 10:09:18 -0400 Andrew Sullivan a...@crankycanuck.ca wrote: On Wed, Jun 25, 2014 at 02:43:25PM +0100, James Le Cuirot wrote: The cookbook currently uses PQexec so multiple SQL commands are wrapped in a transaction unless an explicit transaction instruction appears. I

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread Andrew Sullivan
On Wed, Jun 25, 2014 at 03:16:19PM +0100, James Le Cuirot wrote: Same problem as stdin, the transactional behaviour is different. There is the --single-transaction option but as the man page says... If the script itself uses BEGIN, COMMIT, or ROLLBACK, this option will not have the desired

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread James Le Cuirot
On Wed, 25 Jun 2014 10:24:53 -0400 Andrew Sullivan a...@crankycanuck.ca wrote: On Wed, Jun 25, 2014 at 03:16:19PM +0100, James Le Cuirot wrote: Same problem as stdin, the transactional behaviour is different. There is the --single-transaction option but as the man page says... If the

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread Andrew Sullivan
On Wed, Jun 25, 2014 at 03:37:11PM +0100, James Le Cuirot wrote: Sorry, you're missing the point. I'm trying not to alter the existing behaviour of the Chef database cookbook Ah, got it. Sorry, I'm clueless. No, I don't think I have a suggestion, then. A -- Andrew Sullivan

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread hubert depesz lubaczewski
Perhaps you can explain what is the functionality you want to achieve, as I, for one, don't understand. Do you want transactions? Or not? Also - I have no idea what peer authentication has to do with Pg gem - care to elaborate? The gem is for client, and authentication happens in server, so ... ?

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread James Le Cuirot
On Wed, 25 Jun 2014 16:42:53 +0200 hubert depesz lubaczewski dep...@gmail.com wrote: On Wed, Jun 25, 2014 at 4:37 PM, James Le Cuirot ch...@aura-online.co.uk wrote: On Wed, 25 Jun 2014 10:24:53 -0400 Andrew Sullivan a...@crankycanuck.ca wrote: On Wed, Jun 25, 2014 at 03:16:19PM

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread hubert depesz lubaczewski
On Wed, Jun 25, 2014 at 5:18 PM, James Le Cuirot ch...@aura-online.co.uk wrote: Also - I have no idea what peer authentication has to do with Pg gem - care to elaborate? The gem is for client, and authentication happens in server, so ... ? Right but peer authentication is all to do with

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread Christoph Berg
Re: James Le Cuirot 2014-06-25 20140625144325.49d1124d@red.yakaraplc.local Hello, I've been using the Chef database cookbook and found it frustrating because it doesn't allow you to use peer authentication. The client process generally runs as root and connects to PostgreSQL using the Ruby

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread Jerry Sievers
James Le Cuirot ch...@aura-online.co.uk writes: Hello, I've been using the Chef database cookbook and found it frustrating because it doesn't allow you to use peer authentication. The client process generally runs as root and connects to PostgreSQL using the Ruby pg gem. I have patched it

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread Tom Lane
James Le Cuirot ch...@aura-online.co.uk writes: hubert depesz lubaczewski dep...@gmail.com wrote: Perhaps you can explain what is the functionality you want to achieve, as I, for one, don't understand. Do you want transactions? Or not? I want an implicit transaction around the whole script

[GENERAL] DATA corruption after promoting slave to master

2014-06-25 Thread Karthik Iyer
Hello, We are facing issues of some DB inconsistencies, while promoting the slave to master. [1] We have master-slave with Hot Standby Setup (log shipping). [2] We also have a daemon process which copies the latest partial WAL log file (which postgres is currently writing to, under

Re: [GENERAL] Alternative to psql -c ?

2014-06-25 Thread Merlin Moncure
On Wed, Jun 25, 2014 at 8:43 AM, James Le Cuirot ch...@aura-online.co.uk wrote: Hello, I've been using the Chef database cookbook and found it frustrating because it doesn't allow you to use peer authentication. The client process generally runs as root and connects to PostgreSQL using the

Re: [GENERAL] DATA corruption after promoting slave to master

2014-06-25 Thread Shaun Thomas
On 06/25/2014 06:29 AM, Karthik Iyer wrote: [2] We also have a daemon process which copies the latest partial WAL log file (which postgres is currently writing to, under pg_xlog/) every 3 secs to a different location. No. No, no, no, no no. No. Also, no. Partial WAL files are not valid for

Re: [GENERAL] python modul pre-import to avoid importing each time

2014-06-25 Thread Jeff Janes
On Thu, Jun 19, 2014 at 7:50 AM, RĂ©mi Cura remi.c...@gmail.com wrote: Hey List, I use plpython with postgis and 2 python modules (numpy and shapely). Sadly importing such module in the plpython function is very slow (several hundreds of milliseconds). Is that mostly shapely (which I don't

[GENERAL] Questions about daterange() function

2014-06-25 Thread Ken Tanzer
Hi. I've got lots of tables with start and end dates in them, and I'm trying to learn how to work with them as date ranges (which seem fantastic!). I've noticed that the daterange() function seems to create ranges with an inclusive lower bound, and an exclusive upper bound. For example: SELECT

Re: [GENERAL] Questions about daterange() function

2014-06-25 Thread Adrian Klaver
On 06/25/2014 05:53 PM, Ken Tanzer wrote: Hi. I've got lots of tables with start and end dates in them, and I'm trying to learn how to work with them as date ranges (which seem fantastic!). I've noticed that the daterange() function seems to create ranges with an inclusive lower bound, and an

Re: [GENERAL] Questions about daterange() function

2014-06-25 Thread Ken Tanzer
On Wed, Jun 25, 2014 at 6:12 PM, Adrian Klaver adrian.kla...@aklaver.com wrote: On 06/25/2014 05:53 PM, Ken Tanzer wrote: Hi. I've got lots of tables with start and end dates in them, and I'm trying to learn how to work with them as date ranges (which seem fantastic!). I've noticed that

Re: [GENERAL] Questions about daterange() function

2014-06-25 Thread David G Johnston
Ken Tanzer wrote Hi. I've got lots of tables with start and end dates in them, and I'm trying to learn how to work with them as date ranges (which seem fantastic!). I've noticed that the daterange() function seems to create ranges with an inclusive lower bound, and an exclusive upper bound.