Re: [GENERAL] recommended schema diff tools?

2012-04-13 Thread Thomas Guettler
Hi, about database schema migrations: I am very happy with south http://south.aeracode.org/ It is written for django (python web framework), but could be used for database migrations outside django, too. Thomas Güttler Am 12.04.2012 17:10, schrieb Chris Angelico: On Fri, Apr 13, 2012 at 12

[GENERAL] aggregate arrays

2012-04-13 Thread Dmitry E. Oboukhov
example: a query returns a column that contains arrays: select * FROM (VALUES (ARRAY[1,2,3,3,4], 1), (ARRAY[1,2,2,3,4], 2)) t; column1 | column2 -+- {1,2,3,3,4} | 1 {1,2,2,3,4} | 2 (2 rows) and then we want aggregate that result. example by column2: WITH

Re: [GENERAL] Two entries with the same primary key

2012-04-13 Thread Ivan Evtuhovich
Hello Merlin, we've resynced slave and now everything is OK, thanks you for help. And only one last question, where to read about this bug, because my colleges want to know, what happens. On Fri, Apr 13, 2012 at 00:48, Merlin Moncure wrote: > On Thu, Apr 12, 2012 at 9:20 AM, Ivan Evtuhovich

Re: [GENERAL] Query optimization

2012-04-13 Thread Sergey Konoplev
Hi, On Wed, Apr 11, 2012 at 2:28 PM, wrote: >  I'm looking for materials about query optimization in PostgreSQL. I read > documentation but it doesnt contain much information. Can you recommend a > good book or website when i could learn something about this? I think you can find some good in

Re: [GENERAL] Value to long for type ....: Columnname missing

2012-04-13 Thread Sergey Konoplev
On Thu, Apr 12, 2012 at 12:16 PM, Thomas Guettler wrote: > How can you report feature request? You can submit it here http://www.postgresql.org/support/submitbug/ > >  Thomas Güttler > > > > -- > Thomas Guettler, http://www.thomas-guettler.de/ > E-Mail: guettli (*) thomas-guettler + de > > -- >

Re: [GENERAL] regexp operator for array element compares needed

2012-04-13 Thread Sergey Konoplev
On Thu, Apr 12, 2012 at 10:50 PM, Gauthier, Dave wrote: > ... from 'a.,b.,c*,d*,ee' You can not do like this. > Don't even know if this sort of thing is possible.  I didn't see any > operator like this in the docs.  May have to split out each and compare in > nested loops sith atomic regexp comp

[GENERAL] Postgres 9.0 Streaming Replication and Load Balancing?

2012-04-13 Thread Paulo Correia
Hi! I have a Postgres 9.0 on CentOs 5.6 with a functional asynchronous streaming replication to a hot-standby slave (over a TCP connection). At the moment, the slave only makes the replication, but it accepts read-only queries. I need to load-balance the DB requests to both servers and was

Re: [GENERAL] recommended schema diff tools?

2012-04-13 Thread Bruno Lavoie
Le 2012-04-12 10:57, Welty, Richard a écrit : can anyone recommend an open source tool for diffing schemas? (it should go without saying that i'm looking for ddl to update production and QA DBs from development DBs, but i'll say it, just in case.) thanks, richard Hello, Not free, but

[GENERAL] Updating pg_attribute to change field's data type from integer to bigint on very large table

2012-04-13 Thread Jeff Adams
Greetings, I have a very large table (approximately 1 billion records). I need to change a field's data type from integer to bigint. I started up an ALTER TABLE approach yesterday and it is still running (trying to rewrite the whole table?). I remember seeing mention of being able to do this in th

Re: [GENERAL] aggregate arrays

2012-04-13 Thread Albe Laurenz
Dmitry E. Oboukhov wrote: > example: > > a query returns a column that contains arrays: > > select * FROM (VALUES (ARRAY[1,2,3,3,4], 1), (ARRAY[1,2,2,3,4], 2)) t; >column1 | column2 > -+- > {1,2,3,3,4} | 1 > {1,2,2,3,4} | 2 > (2 rows) > > and then we want

Re: [GENERAL] Updating pg_attribute to change field's data type from integer to bigint on very large table

2012-04-13 Thread Tom Lane
Jeff Adams writes: > I have a very large table (approximately 1 billion records). I need to > change a field's data type from integer to bigint. I started up an ALTER > TABLE approach yesterday and it is still running (trying to rewrite the > whole table?). I remember seeing mention of being able

Re: [GENERAL] Updating pg_attribute to change field's data type from integer to bigint on very large table

2012-04-13 Thread Tom Lane
I wrote: > No, that is an actual on-disk change (making the field physically > wider), so it's going to cost ya. There are some cases where the > on-disk representation doesn't change and so a catalog update isn't > needed, but int4->int8 isn't one of them. Sheesh, hit send too quickly on that.

Re: [GENERAL] Updating pg_attribute to change field's data type from integer to bigint on very large table

2012-04-13 Thread Jeff Adams
so i can? if so, how do i go about? i should mention that, while i dabble in postgres dba activity, it is not my day job... On Fri, Apr 13, 2012 at 11:27 AM, Tom Lane wrote: > I wrote: > > No, that is an actual on-disk change (making the field physically > > wider), so it's going to cost ya. Th

Re: [GENERAL] Updating pg_attribute to change field's data type from integer to bigint on very large table

2012-04-13 Thread Bèrto ëd Sèra
Hi Jeff, read carefully, he said it does stuff ON DISK, which means that all of your fields must be physically remade (so it a lot more than telling it "it's an int4, Sheila", which is what just modifying the catalog would do). Since you are not a dba be aware that you are producing a new record f

Re: [GENERAL] Updating pg_attribute to change field's data type from integer to bigint on very large table

2012-04-13 Thread Steve Crawford
On 04/13/2012 08:30 AM, Jeff Adams wrote: so i can? if so, how do i go about? i should mention that, while i dabble in postgres dba activity, it is not my day job... That really depends on details and your concerns. Is the database used for constant insert/update/select activity or is it a big

[GENERAL] Subselect with incorrect column not a syntax error?

2012-04-13 Thread Mike Blackwell
Could someone please explain to me why the following select does not result in a syntax error? (9.0.3) begin; create table x( c1 integer , c2 integer); create table y( c3 integer, c4 integer); select * from x where c2 in ( select c2 from y where c4 = 2 ); rollback; Mike -- Sent via pgsql-g

Re: [GENERAL] Subselect with incorrect column not a syntax error?

2012-04-13 Thread Jack Christensen
On 4/13/2012 11:39 AM, Mike Blackwell wrote: Could someone please explain to me why the following select does not result in a syntax error? (9.0.3) begin; create table x( c1 integer , c2 integer); create table y( c3 integer, c4 integer); select * from x where c2 in ( select c2 from y where c4

Re: [GENERAL] Updating pg_attribute to change field's data type from integer to bigint on very large table

2012-04-13 Thread Jeff Adams
Thanks for the ideas Steve. I am actually working with a partitioned table and the field I am modifying is the id field (I have reached the cap on the integer data type and need to modify it to bigint - very poor planning on my part!), but no related tables exist. The id field in the partitioned ta

[GENERAL] Tab completion not working on OSX Lion (10.7.3)

2012-04-13 Thread Bryan Hughes
Prior to updating my Snow Leopard Mac to OSX Lion (10.7.3), I was able to open psql from a terminal and then use "tab complete" to auto-complete table or field names (i.e., "select * from [TAB -- list of table names]"). Unfortunately, something appears to have changed and tab complete now does noth

[GENERAL] Problems with restoring data (using pg_restore)

2012-04-13 Thread Christian Andersen
Hi guys, I have a script exporting a series of schemas from one database (test) to another database (production). I´ve noticed that some of the tables are not correctly updated resulting in old datas in the productiondb. I´ve looked in the logfiles and noticed the following: CMD: E:\spatialsu

[GENERAL] Problems with restoring data (using pg_restore)

2012-04-13 Thread Christian Andersen
Hi guys, I have a script exporting a series of schemas from one database (test) to another database (production). I´ve noticed that some of the tables are not correctly updated resulting in old datas in the productiondb. I´ve looked in the logfiles and noticed the following: CMD: E:\spatialsu

Re: [GENERAL] Value to long for type ....: Columnname missing

2012-04-13 Thread Guillaume Lelarge
On Fri, 2012-04-13 at 17:19 +0400, Sergey Konoplev wrote: > On Thu, Apr 12, 2012 at 12:16 PM, Thomas Guettler wrote: > > How can you report feature request? > > You can submit it here http://www.postgresql.org/support/submitbug/ > No, this allows you to report a bug, not a feature request. --

Re: [GENERAL] Subselect with incorrect column not a syntax error?

2012-04-13 Thread Scott Marlowe
On Fri, Apr 13, 2012 at 11:59 AM, Jack Christensen wrote: > On 4/13/2012 11:39 AM, Mike Blackwell wrote: >> >> Could someone please explain to me why the following select does not >> result in a syntax error?  (9.0.3) >> >> begin; >> >> create table x( c1 integer , c2 integer); >> create table y(

Re: [GENERAL] Value to long for type ....: Columnname missing

2012-04-13 Thread Scott Marlowe
On Thu, Apr 12, 2012 at 2:16 AM, Thomas Guettler wrote: > Hi, > > I think it would be very good, if postgresql reports which column is too > small: > >   Value to long for type character varying(1024) (message translated from > german to english) > > Is there a reason not to report the column name

Re: [GENERAL] Subselect with incorrect column not a syntax error?

2012-04-13 Thread Mike Blackwell
Indeed. __ Mike Blackwell | Technical Analyst, Distribution Services/Rollout Management | RR Donnelley 1750 Wallace Ave | St Charles, IL 60174-3401 Office: 630.313.7818 mike.blackw...@rrd.com http://www.rrdonnelley.com

Re: [GENERAL] PGBouncer help (how to get it working)

2012-04-13 Thread Phoenix Kiula
On Fri, Apr 13, 2012 at 2:59 PM, Raghavendra wrote: . >> Add it in pgbouncer.auth file as per your .ini file parameter. >> >>    auth_file = /var/lib/pgsql/pgbouncer.txt >> > > Seems you already did this. I believe you are connecting as postgres user > not from root, if yes, then check .

Re: [GENERAL] Tab completion not working on OSX Lion (10.7.3)

2012-04-13 Thread Steve Crawford
On 04/13/2012 10:27 AM, Bryan Hughes wrote: Prior to updating my Snow Leopard Mac to OSX Lion (10.7.3), I was able to open psql from a terminal and then use "tab complete" to auto-complete table or field names (i.e., "select * from [TAB -- list of table names]"). Unfortunately, something appear

Re: [GENERAL] Tab completion not working on OSX Lion (10.7.3)

2012-04-13 Thread Tom Lane
Bryan Hughes writes: > Prior to updating my Snow Leopard Mac to OSX Lion (10.7.3), I was able to > open psql from a terminal and then use "tab complete" to auto-complete > table or field names (i.e., "select * from [TAB -- list of table names]"). > Unfortunately, something appears to have changed

Re: [GENERAL] Tab completion not working on OSX Lion (10.7.3)

2012-04-13 Thread John R Pierce
On 04/13/12 12:07 PM, Tom Lane wrote: Apple broke this (again, or should I say worse) in their Lion update of libedit. libedit has a long and nasty track record of being quite buggy. I was using it briefly on a couple Unix systems we were trying to avoid gnupollution on and found it was way

Re: [GENERAL] Two entries with the same primary key

2012-04-13 Thread Merlin Moncure
On Fri, Apr 13, 2012 at 7:36 AM, Ivan Evtuhovich wrote: > Hello Merlin, > > we've resynced slave and now everything is OK, thanks you for help. > > And only one last question, where to read about this bug, because > my colleges  want to know, what happens. there are several standby related issues

Re: [GENERAL] Tab completion not working on OSX Lion (10.7.3)

2012-04-13 Thread Tom Lane
John R Pierce writes: > On 04/13/12 12:07 PM, Tom Lane wrote: >> Apple broke this (again, or should I say worse) in their Lion update of >> libedit. > libedit has a long and nasty track record of being quite buggy. I was > using it briefly on a couple Unix systems we were trying to avoid > gn

Re: [GENERAL] Tab completion not working on OSX Lion (10.7.3)

2012-04-13 Thread John R Pierce
On 04/13/12 1:16 PM, Tom Lane wrote: Yeah, to be fair the bug in question is upstream's, not Apple's. I'm just griping because they seem to grab random snapshots of upstream's SCM and release them with hardly any testing. It would possibly be all right if they didn't then sit on that release for

[GENERAL] Preventing an 'after' trigger from causing rollback on error

2012-04-13 Thread Eliot Gable
Is there any way I can stop a trigger which fires after a row is inserted into a table from causing a rollback of the entire transaction if something goes wrong? I have rows being written to a table, and I have triggers which calculate and update statistics automatically in stats tables based on t

Re: [GENERAL] Preventing an 'after' trigger from causing rollback on error

2012-04-13 Thread Jeff Davis
On Fri, 2012-04-13 at 17:58 -0400, Eliot Gable wrote: > Is there any way I can stop a trigger which fires after a row is > inserted into a table from causing a rollback of the entire > transaction if something goes wrong? 1. Try using subtransactions ( http://www.postgresql.org/docs/9.1/static/sql

Re: [GENERAL] Preventing an 'after' trigger from causing rollback on error

2012-04-13 Thread Scott Marlowe
On Fri, Apr 13, 2012 at 3:58 PM, Eliot Gable wrote: > Is there any way I can stop a trigger which fires after a row is inserted > into a table from causing a rollback of the entire transaction if something > goes wrong? Take look here: http://www.postgresql.org/docs/9.0/static/plpgsql-porting.ht

[GENERAL] how to list all the schema and the privileges which is granted to users.THanks.

2012-04-13 Thread leaf_yxj
how to list all the schema and the privileges which is granted to users.THanks. I know how to list all the objects privileges : \dp But I don't know how to list the schema's privileges?? Thanks. Regards. Grace -- View this message in context: http://postgresql.1045698.n5.nabble.com/how-to-lis

Re: [GENERAL] how to list all the schema and the privileges which is granted to users.THanks.

2012-04-13 Thread raghu ram
On Sat, Apr 14, 2012 at 6:47 AM, leaf_yxj wrote: > how to list all the schema and the privileges which is granted to > users.THanks. > > I know how to list all the objects privileges : > \dp > > But I don't know how to list the schema's privileges?? > Schema Privileges: postgres=# \dn+

Re: [GENERAL] Tab completion not working on OSX Lion (10.7.3)

2012-04-13 Thread Bryan Hughes
I now have "libreadline.a" in /usr/local/lib. Assuming that's the goal, would you be kind enough to walk me through the next step -- linking that lib to psql? bryan On Fri, Apr 13, 2012 at 3:07 PM, Tom Lane wrote: > Bryan Hughes writes: > > Prior to updating my Snow Leopard Mac to OSX Lion (10

Re: [GENERAL] Tab completion not working on OSX Lion (10.7.3)

2012-04-13 Thread Tom Lane
Bryan Hughes writes: > I now have "libreadline.a" in /usr/local/lib. Assuming that's the goal, > would you be kind enough to walk me through the next step -- linking that > lib to psql? I think it should work to just configure and build postgres the same as you otherwise would --- I believe Apple

[GENERAL] Error with compile source code on CentOS5.7

2012-04-13 Thread go.dbms
Hi, all I have some errors when I compiling PostgreSQL9.1.3's source code (9.1.2 is also same as) on CentOS5.7(x86_64). The above are detail infomations. -- $ uname -a Linux centos57 2.6.18-274.el5 #1 SMP Fri Jul 22 04:43:29 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux $ make make -C src all : : :

Re: [GENERAL] Error with compile source code on CentOS5.7

2012-04-13 Thread Tom Lane
"go.dbms" writes: > gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith > -Wdeclaration-after-statement -Wendif-labels -Wformat-security > -fno-strict-aliasing -fwrapv pg_dump.o common.o pg_dump_sort.o keywords.o > kwlookup.o pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o > pg_backup_fi

[GENERAL] Horizontal aggregation?

2012-04-13 Thread hamann . w
Hi, I am looking for a feature that would select from a table with k1 a k1 b k1 c k2 a k3 b k3 c something like k1 a b c k2 a k3 b c (Just all elements next to each other, with a space in between) or perhaps an array output k1 {a,b,c] k2 {a} k3 {b,c} If such an operator exists, woul

Re: [GENERAL] Horizontal aggregation?

2012-04-13 Thread Abel Abraham Camarillo Ojeda
On Sat, Apr 14, 2012 at 1:22 AM, wrote: > > > Hi, > > I am looking for a feature that would select from a table with > k1  a > k1  b > k1  c > k2  a > k3  b > k3  c > something like > k1  a b c > k2  a > k3  b c > (Just all elements next to each other, with a space in between) > or perhaps an arr

Re: [GENERAL] Horizontal aggregation?

2012-04-13 Thread Abel Abraham Camarillo Ojeda
On Sat, Apr 14, 2012 at 1:28 AM, Abel Abraham Camarillo Ojeda wrote: > On Sat, Apr 14, 2012 at 1:22 AM,   wrote: >> >> >> Hi, >> >> I am looking for a feature that would select from a table with >> k1  a >> k1  b >> k1  c >> k2  a >> k3  b >> k3  c >> something like >> k1  a b c >> k2  a >> k3  b

Re: [GENERAL] non-static LIKE patterns

2012-04-13 Thread hamann . w
>> >> haman...@t-online.de writes: >> > Tom Lane wrote: >> > If you want it to be bulletproof, what I'd think about is something like >> >WHERE second.path LIKE quote_like(first.path)||'%' >> >> > Just out of curiosity: wouldn't that (as well as using non-static like) >> > be an enormous perf