Re: [GENERAL] Is it possible to make a streaming replication faster using COPY instead of lots of INSERTS?

2011-12-01 Thread Sergey Konoplev
On 1 December 2011 03:44, Craig Ringer wrote: > Streaming replication works on a rather lower level than that. It records > information about transaction starts, rollbacks and commits, and records > disk block changes. It does not record SQL statements. It's not using > INSERT, so you can't switch

Re: [GENERAL] Is it possible to make a streaming replication faster using COPY instead of lots of INSERTS?

2011-12-01 Thread Sergey Konoplev
On 1 December 2011 04:00, David Johnston wrote: > On Nov 30, 2011, at 18:44, Craig Ringer wrote: > >> On 11/30/2011 10:32 PM, Sergey Konoplev wrote: > Insert into tbl values(...); [times 50] > insert into tbl values (...), (...), (...), ...; [ once with 50 values ] > Copy [ with 50 input rows pro

Re: [GENERAL] Limiting number of connections to PostgreSQL per IP (not per DB/user)?

2011-12-01 Thread Tomas Vondra
On 29.11.2011 23:38, Merlin Moncure wrote: > On Tue, Nov 29, 2011 at 7:49 AM, Heiko Wundram > wrote: >> Hello! >> >> Sorry for that subscribe post I've just sent, that was bad reading on my >> part (for the subscribe info on the homepage). >> >> Anyway, the title says it all: is there any possibi

Re: [GENERAL] Strange problem with turning WAL archiving on

2011-12-01 Thread Albe Laurenz
BK wrote: [server complains that wal_level is not set correctly] >> Did you change the correct postgresql.conf? >> Are there more than one lines for wal_level in the file >> (try "grep wal_level postgresql.conf")? > > I tried greping, there is just one nstance of it and is set on archive. > > Any

[GENERAL] How to get Place Names from Lat Lon

2011-12-01 Thread Adarsh Sharma
Dear all, I have a position table that contains the lat lon of an entity from time to time. Now I want to get the place names from the respective lat lon. In the past , I am able to get the country names in which the lat lon falls because I have a table that contains the geom of all countrie

[GENERAL] Problem with binary data transfer format of TEXT in 8.4

2011-12-01 Thread Gracjan Polak
Hi all, (Please redirect me to correct place if there is one). I'm trying to implement proper binary data transfer in Database.HDBC.PostgreSQL Haskell library. This library is a wrapper around libpq. I sorted out how to use paramFormats[] param of PQexecParams. I sorted out how to retrieve and p

Re: [GENERAL] psql query gets stuck indefinitely

2011-12-01 Thread tamanna madaan
Hi Craig I am able to reproduce the issue now . I have postgres-8.1.2 installed in cluster setup. I have started the below query from one system let say A to system B in cluster . psql -U -h -c "select sleep(300);" while this command is going on , system B is stopped abruptly by taking out the po

[GENERAL] Conditional left join

2011-12-01 Thread Amitabh Kant
I have the following table structure on Postgres 8.4 : STRUCTURE: tblunit unit_id [integer] unit_location [character varying] DATA: 1,'location1' 2,'location2' 3,'location3' STRUCTURE: tbloperator operator_id [integer] operator_name [character varying] DATA: 1,'operator1' 2,'op

Re: [GENERAL] Conditional left join

2011-12-01 Thread Alban Hertroys
On 1 December 2011 13:16, Amitabh Kant wrote: > I am trying (through conditional left join?) to fetch all records of tbldata > and the operator name from tbloperators who was operating the unit at event > time. If no operator was present, it should return null. I think you want something akin to:

Re: [GENERAL] How to restore the table space tar files created by pg_basebackup?

2011-12-01 Thread Samba
Hi Venkat, I verified that the tablespaces are located in actual directories and not any symbolic links. Another interesting thing is that the content in these additional tar.gz files is already present in the base.tar.gz file. Regards, Samba --

[GENERAL] Streaming Replication Over SSL

2011-12-01 Thread Samba
Hi all, I searched a lot to find if some one has written about this but could not find any successful attempt, hence thought of posting it here. setting the sslmode='require' in the 'primary_conninfo' parameter in the recovery.conf file on standby server would make the standby server make an SSL c

[GENERAL] Replication issue

2011-12-01 Thread Jim Buttafuoco
All,I have a large PG 9.1.1 server and replica using log shipping.  I had some hardware issues on the replica system and now I am getting the following in my pg_log/* files.  Same 2 lines over and over since yesterday.2011-12-01 07:46:30 EST  >LOG:  restored log file "0001028E00E5" from

Re: [GENERAL] Limiting number of connections to PostgreSQL per IP (not per DB/user)?

2011-12-01 Thread Tomas Vondra
On 1 Prosinec 2011, 13:47, Magnus Hagander wrote: > On Thu, Dec 1, 2011 at 01:03, Tomas Vondra wrote: >> Anyway, I do have an idea how this could be done using a shared library >> (so it has the same disadvantages as logon triggers). Hopefully I'll >> have time to implement a PoC of this over the

Re: [GENERAL] psql query gets stuck indefinitely

2011-12-01 Thread Tomas Vondra
On 1 Prosinec 2011, 12:57, tamanna madaan wrote: > Hi Craig > I am able to reproduce the issue now . I have postgres-8.1.2 installed in > cluster setup. Well, the first thing you should do is to upgrade, at least to the last 8.1 minor version, which is 8.1.22. It may very well be an already fixed

Re: [GENERAL] How to restore the table space tar files created by pg_basebackup?

2011-12-01 Thread Magnus Hagander
It will be that if you have the tablespaces in the actual directories. The question is how and why you ended up with the tablespaces in the actual directories there, and not symlinks. It seems rather pointless to have tablespaces if they go in there... //Magnus On Thu, Dec 1, 2011 at 13:35, Samba

Re: [GENERAL] Streaming Replication Over SSL

2011-12-01 Thread Magnus Hagander
On Thu, Dec 1, 2011 at 13:48, Samba wrote: > Hi all, > I searched a lot to find if some one has written about this but could not > find any successful attempt, hence thought of posting it here. > > setting the sslmode='require' in the 'primary_conninfo' parameter in the > recovery.conf file on sta

[GENERAL] session hang for same row update

2011-12-01 Thread AI Rumman
Could anyone please tell me why the session 2 is hanging? I am using Postgresql 9.1. show deadlock_timeout ; deadlock_timeout -- 1s (1 row) select * from t2; i | nam ---+- 2 | t4 1 | t3 Session 1: BEGIN update t2 set nam = 't3' where i=2; UPDATE 1 Session 2: BEGIN up

Re: [GENERAL] session hang for same row update

2011-12-01 Thread Adrian Klaver
On Thursday, December 01, 2011 7:10:15 am AI Rumman wrote: > Could anyone please tell me why the session 2 is hanging? > I am using Postgresql 9.1. > > show deadlock_timeout ; > deadlock_timeout > -- > 1s > (1 row) > > > select * from t2; > i | nam > ---+- > 2 | t4 > 1

Re: [GENERAL] Problem with custom aggregates and record pseudo-type

2011-12-01 Thread Tom Lane
Maxim Boguk writes: > I created special custom aggregate function to append arrays defined as: > CREATE AGGREGATE array_accum (anyarray) > ( > sfunc = array_cat, > stype = anyarray, > initcond = '{}' > ); > On arrays of common types it work without any problems: > SELECT array_accum(

[GENERAL] recursive inner trigger call

2011-12-01 Thread Red Light
Hi guys, i got the following problematic : i got a table called bv that have some 'entry data' and i have another column that need to be calculated and put back in the table: here is my table: CREATE TABLE public.bv (   id_bv integer NOT NULL,   c_vmax_actuel real,   d_capacite_barrages_new

Re: [GENERAL] recursive inner trigger call

2011-12-01 Thread Gauthier, Dave
You set the trigger to fire off whenever ed_expore.bv is inserted or updated. Then the trigger updates ed_explore.bv, which fires the update trigger again, etc... . Infinite loop. No? Maybe you just want to use a before trigger to set that value before the insert, then you wouldn't need the

Re: [GENERAL] recursive inner trigger call

2011-12-01 Thread Red Light
Hi Dave, when i use before trigger , nothing happen; i mean no cumputation is done  (and when i start tu duplicate the same data just by mistake ...) i got the same error. From: "Gauthier, Dave" To: Red Light ; "pgsql-general@postgresql.org" Sent: Thursd

[GENERAL] problem with restore: collision id`s lob

2011-12-01 Thread Hellmuth Vargas
is that I have a number of postgres cluster we want to consolidate into a single cluster. Every cluster has a database with different schemas names each therefore inprinciple could create a single database where they could live all schemas and should have no problem, we generate a dump and SQL file

Re: [GENERAL] recursive inner trigger call

2011-12-01 Thread David Johnston
CREATE OR REPLACE FUNCTION public.store_bv() RETURNS TRIGGER AS $store_bv$ DECLARE v_vmax_actuel numeric(15,2); BEGIN IF (TG_OP = 'UPDATE') OR (TG_OP = 'INSERT') THEN update ed_explore."bv" set c_vmax_actuel = ((d_capacite_barrages_new) / (3

Re: [GENERAL] recursive inner trigger call

2011-12-01 Thread Bèrto ëd Sèra
Hi Red, I have the slight suspicion that you have not understood what NEW and OLD mean, in the context of a trigger, am I correct? See http://www.postgresql.org/docs/9.0/static/plpgsql-trigger.html Bèrto On 1 December 2011 22:17, Red Light wrote: > > Hi Dave, > > when i use before trigger , n

Re: [GENERAL] recursive inner trigger call

2011-12-01 Thread Red Light
Hi David, Thanks a lot. From: David Johnston To: 'Red Light' ; "'Gauthier, Dave'" Cc: pgsql-general@postgresql.org Sent: Thursday, December 1, 2011 8:31 PM Subject: RE: [GENERAL] recursive inner trigger call CREATE OR REPLACE FUNCTION public.store_bv()

Re: [GENERAL] Problem with custom aggregates and record pseudo-type

2011-12-01 Thread Maxim Boguk
On Fri, Dec 2, 2011 at 3:19 AM, Tom Lane wrote: > Maxim Boguk writes: > > I created special custom aggregate function to append arrays defined as: > > CREATE AGGREGATE array_accum (anyarray) > > ( > > sfunc = array_cat, > > stype = anyarray, > > initcond = '{}' > > ); > > > > On arra

[GENERAL] returning rows from an implicit JOIN where results either exist in both tables OR only one table

2011-12-01 Thread Lonni J Friedman
Greetings, I've got a PostgreSQL-9.0.x database that manages an automated testing environment. There are a bunch of tables that contain assorted static data (OS versions, test names, etc) named 'buildlist' & 'osversmap'. However, there are also two tables which contain data which changes often. T

Re: [GENERAL] returning rows from an implicit JOIN where results either exist in both tables OR only one table

2011-12-01 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Lonni J Friedman Sent: Thursday, December 01, 2011 4:13 PM To: pgsql-general Subject: [GENERAL] returning rows from an implicit JOIN where results either exist in both tabl

[GENERAL] psql -1 with multiple files?

2011-12-01 Thread Jay Levitt
Is there a way to load multiple .sql files in a single transaction? It looks like "psql -f file1 -f file2" or "psql -f file*" was a WIP patch that never happened, and from what I can tell, psql ignores the -1 parameter when reading from STDIN, so I can't cat them together either: $ cat > am_i_

Re: [GENERAL] psql -1 with multiple files?

2011-12-01 Thread Steve Crawford
On 12/01/2011 02:01 PM, Jay Levitt wrote: Is there a way to load multiple .sql files in a single transaction? It looks like "psql -f file1 -f file2" or "psql -f file*" was a WIP patch that never happened, and from what I can tell, psql ignores the -1 parameter when reading from STDIN, so I can'

Re: [GENERAL] psql -1 with multiple files?

2011-12-01 Thread Jay Levitt
Steve Crawford wrote: On 12/01/2011 02:01 PM, Jay Levitt wrote: Is there a way to load multiple .sql files in a single transaction? Alternately, since -1 basically wraps your input in a BEGIN...your statements...COMMIT you could do that yourself with a begin.sql and commit.sql: cat begin.sql f

Re: [GENERAL] Query Optimizer makes a poor choice

2011-12-01 Thread Marcin Mańk
On Tue, Nov 29, 2011 at 7:21 PM, Tyler Hains wrote: > # explain analyze select * from cards where card_set_id=2850 order by > card_id limit 1; >    QUERY PLAN > -

[GENERAL] Postgresql + corrupted disk = data loss. (Need help for database recover)

2011-12-01 Thread Oleg Serov
Hello, i have a problem. I've got a production server, working fine. Then i've got strange error: > ERROR: right sibling's left-link doesn't match: block 147 links to 407 instead of expected 146 in index "order_status_key"' And decidet to backup all server. So i shut-down VPS with server and back

Re: [GENERAL] Postgresql + corrupted disk = data loss. (Need help for database recover)

2011-12-01 Thread Oleg Serov
And, i'm an idiot. My DB version: PostgreSQL 8.4.9 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-51), 64-bit 2011/12/2 Oleg Serov > Hello, i have a problem. > > I've got a production server, working fine. Then i've got strange error: > > ERROR: right sibl

Re: [GENERAL] returning rows from an implicit JOIN where results either exist in both tables OR only one table

2011-12-01 Thread Lonni J Friedman
On Thu, Dec 1, 2011 at 1:57 PM, David Johnston wrote: > -Original Message- > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Lonni J Friedman > Sent: Thursday, December 01, 2011 4:13 PM > To: pgsql-general > Subject: [GENERAL] returning

Re: [GENERAL] Postgresql + corrupted disk = data loss. (Need help for database recover)

2011-12-01 Thread Venkat Balaji
2011/12/2 Oleg Serov > And, i'm an idiot. > > My DB version: > PostgreSQL 8.4.9 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) > 4.1.2 20080704 (Red Hat 4.1.2-51), 64-bit > > > > 2011/12/2 Oleg Serov > >> Hello, i have a problem. >> >> I've got a production server, working fine. Then i've