Re: [GENERAL] Disconnecting and cancelling a statement

2011-09-07 Thread Jeff Davis
On Wed, 2011-09-07 at 14:46 +0800, Craig Ringer wrote: > > Right now, PostgreSQL doesn't seem to make an effort to detect a client > > cancellation. For instance, if you do a "select pg_sleep(1000)" and then > > kill -9 the client, the SELECT will remain running. > > pg_sleep isn't a good test. In

Re: [GENERAL] Complex query question

2011-09-07 Thread Jayadevan M
Hello, > I have a complex query question whose answer I think would help me to > understand subselects and aggregates better. I have a table with four > columns of interest: > > id (int primary key), loc_title (varchar null), loc_value (float > null), loc_unit (varchar null) > > I want the output

Re: [GENERAL] Complex query question

2011-09-07 Thread Albe Laurenz
Mike Orr wrote: > I have a complex query question whose answer I think would help me to > understand subselects and aggregates better. I have a table with four > columns of interest: > > id (int primary key), loc_title (varchar null), loc_value (float > null), loc_unit (varchar null) > > I want t

Re: [GENERAL] SSL certificates issue

2011-09-07 Thread Asia
> Asia writes: > > I would expect to have only one top-level CA cert in server's and client's > > root.crt and it was not possible to configure with 2-level intermediate CA. > > This seems a little confused, since in your previous message you stated > that libpq worked correctly and JDBC did no

Re: [GENERAL] SSL certificates issue

2011-09-07 Thread Radosław Smogura
On Wed, 07 Sep 2011 12:03:45 +0200, Asia wrote: Asia writes: > I would expect to have only one top-level CA cert in server's and client's root.crt and it was not possible to configure with 2-level intermediate CA. This seems a little confused, since in your previous message you stated that

Re: [GENERAL] SSL certificates issue

2011-09-07 Thread Asia
> > I think problem is as follows, server sends to client certificates it > can accept (as accepted parents), without intermediate CA, Java sees > only top-level cert and tries to find client cert issued directly by > top-level CA, I may only assume, that without intermediate CA you will > be

Re: [GENERAL] Demoting master to slave without an rsync...is it safe?

2011-09-07 Thread Alex Lai
Chris Redekop wrote: I have two questions: (1) Did you set recovery_target_timeline='latest' in both master and slave? Yesbut it's in recovery.conf so it only really applies to whichever server is currently the slave... (2) Did you make any changes after promote the s

Re: [GENERAL] SSL certificates issue

2011-09-07 Thread Radosław Smogura
On Wed, 07 Sep 2011 13:49:30 +0200, Asia wrote: I think problem is as follows, server sends to client certificates it can accept (as accepted parents), without intermediate CA, Java sees only top-level cert and tries to find client cert issued directly by top-level CA, I may only assume, that

Re: [GENERAL] SSL certificates issue

2011-09-07 Thread Adrian Klaver
On Wednesday, September 07, 2011 4:49:30 am Asia wrote: > > The problem is that I believe that this configuration could be better but I > cannot put part of CA chain in root.crt as it was advised. > For Java it all depends on current SSL Factory implementation, I was using > the default one. If I

Re: [GENERAL] SSL certificates issue

2011-09-07 Thread Asia
> > I personally haven't tired SSL for PostgreSQL but, I think, You should > put in root.crt only intermediate certificate (C1 - from prev post), so > all and only all "sub-certs" of intermediate CA will be able to > establish connection (paranoic security). > > Putting intermediate CAs as tru

Re: [GENERAL] SSL certificates issue

2011-09-07 Thread Tom Lane
Asia writes: > The problem is that I believe that this configuration could be better but I > cannot put part > of CA chain in root.crt as it was advised. > For Java it all depends on current SSL Factory implementation, I was using > the default one. > If I wrote my own implementation I would pr

Re: [GENERAL] SSL certificates issue

2011-09-07 Thread Asia
I have a feeling that jdbc list is not the right list to ask why libpq does not work when I put top-level CA cert from CA having two certs in root.crt while you stated it would be proper configuration. There are 2 related threads here: one with consistency between libpq and jdbc driver and the

Re: [GENERAL] SSL certificates issue

2011-09-07 Thread Tom Lane
Asia writes: > I have a feeling that jdbc list is not the right list to ask why libpq does > not work when I > put top-level CA cert from CA having two certs in root.crt while you stated > it would be > proper configuration. What is a "CA having two certs"? AFAIK, there is no such animal.

Re: [GENERAL] conditional insert

2011-09-07 Thread Lincoln Yeoh
At 05:23 AM 9/7/2011, Merlin Moncure wrote: On Tue, Sep 6, 2011 at 3:45 PM, Merlin Moncure wrote: > b) doesn't block reads if you lock in EXCLUSIVE mode. a) is the best > way to go if you prefer to handle errors on the client and/or > concurrency is important...c) otherwise. whoops! meant to

Re: [GENERAL] conditional insert

2011-09-07 Thread Andrew Sullivan
On Wed, Sep 07, 2011 at 11:45:11PM +0800, Lincoln Yeoh wrote: > Don't you have to block SELECTs so that the SELECTs get serialized? If you want to do that, why wouldn't you just use serializable mode? A -- Andrew Sullivan a...@crankycanuck.ca -- Sent via pgsql-general mailing list (pgsql-gene

Re: [GENERAL] PL/pgSQL trigger and sequence increment

2011-09-07 Thread jonesd
Seems like you would be a lot better off enforcing this with a unique index on (submitter_id, date_trunc('month',entry_timestamp)). The above not only doesn't provide any feedback, it's got serious race-condition problems. I'll take a look at using an index to do this. The trigger is an ugly

Re: [GENERAL] SSL certificates issue

2011-09-07 Thread Radosław Smogura
Asia Wednesday 07 of September 2011 16:00:39 > > I personally haven't tired SSL for PostgreSQL but, I think, You should > > put in root.crt only intermediate certificate (C1 - from prev post), so > > all and only all "sub-certs" of intermediate CA will be able to > > establish connection (paranoic

Re: [GENERAL] PL/pgSQL trigger and sequence increment

2011-09-07 Thread jonesd
Seems like you would be a lot better off enforcing this with a unique index on (submitter_id, date_trunc('month',entry_timestamp)). The above not only doesn't provide any feedback, it's got serious race-condition problems. Unfortunately, it didn't work. CREATE UNIQUE INDEX one_entry_per_submit

Re: [GENERAL] SSL certificates issue

2011-09-07 Thread Andrew Sullivan
On Wed, Sep 07, 2011 at 04:37:24PM +0200, Asia wrote: > put top-level CA cert from CA having two certs in root.crt [. . .] > how libpq works with chained CA's. "Two certs" and "chained CAs" are completely different problems. What are you trying to do, exactly? A -- Andrew Sullivan a...@cran

Re: [GENERAL] PL/pgSQL trigger and sequence increment

2011-09-07 Thread Tom Lane
jon...@xmission.com writes: > CREATE UNIQUE INDEX one_entry_per_submitter_per_month ON table_entry > (submitter_id , date_trunc('month',entry_timestamp)); > runs into > ERROR: functions in index expression must be marked IMMUTABLE. > If I'm reading this correctly, date_trunc is not IMMUTABLE an

Re: [GENERAL] Complex query question

2011-09-07 Thread Mike Orr
This works beautifully. Thanks to you and Osvaldo; I learned something more about querying today. I wasn't so much wanting to learn about subqueries as to how to do these kinds of queries. In this case, I'm testing a search routine, and I needed to extract some possible results to expect. (I actu

Re: [GENERAL] Advice on HA option

2011-09-07 Thread hyelluas
Thank you, I will look at skype's walmgr. Also could you explain what makes it "hands free administration" 9.0? Is the shipping of the wal file from the master to HA instance automated ? Any error checking /self recovery? thank you much for the suggestion. Helen -- View this message in con

[GENERAL] checkpoint logs

2011-09-07 Thread Martín Marqués
I'm logging checkpoints to see how the background writter is working, and I bumped into log information that I don't fully understand: LOG: checkpoint complete: wrote 5015 buffers (15.1%); 0 transaction log file(s) added, 0 removed, 15 recycled; write=1004.333 s, sync=0.106 s, total=1004.571 s 5

Re: [GENERAL] conditional insert

2011-09-07 Thread Merlin Moncure
On Wed, Sep 7, 2011 at 10:45 AM, Lincoln Yeoh wrote: > At 05:23 AM 9/7/2011, Merlin Moncure wrote: >> >> On Tue, Sep 6, 2011 at 3:45 PM, Merlin Moncure wrote: >> >> > b) doesn't block reads if you lock in EXCLUSIVE mode.  a) is the best >> > way to go if you prefer to handle errors on the client

Re: [GENERAL] conditional insert

2011-09-07 Thread Andrew Sullivan
On Wed, Sep 07, 2011 at 02:51:32PM -0500, Merlin Moncure wrote: > > @andrew s: going SERIALIZABLE doesn't help if you trying to eliminate > cases that would push you into retrying the transaction. Well, no, of course. But why not catch the failure and retry? I guess I just don't get the problem

Re: [GENERAL] conditional insert

2011-09-07 Thread Merlin Moncure
On Wed, Sep 7, 2011 at 3:04 PM, Andrew Sullivan wrote: > On Wed, Sep 07, 2011 at 02:51:32PM -0500, Merlin Moncure wrote: >> >> @andrew s: going SERIALIZABLE doesn't help if you trying to eliminate >> cases that would push you into retrying the transaction. > > Well, no, of course.  But why not cat

Re: [GENERAL] checkpoint logs

2011-09-07 Thread Tomas Vondra
On 7 Září 2011, 21:26, Martín Marqués wrote: > I'm logging checkpoints to see how the background writter is working, > and I bumped into log information that I don't fully understand: > > LOG: checkpoint complete: wrote 5015 buffers (15.1%); 0 transaction > log file(s) added, 0 removed, 15 recycle

[GENERAL] Problem using PostgreSQL 9.0.4 with Java

2011-09-07 Thread Arun Nadar
Hi I am currently using 'PostgreSQL 9.0.4' database with JDBC driver 'postgresql-9.0-801.jdbc4'. In my Java program normal SELECT query didn't work. ie,  try {             Class.forName("org.postgresql.Driver");             connection = DriverManager.getConnection("jdbc:postgresql://localhos

Re: [GENERAL] Problem using PostgreSQL 9.0.4 with Java

2011-09-07 Thread Tomas Vondra
On 7 Září 2011, 22:45, Arun Nadar wrote: > Hi > > > I am currently using 'PostgreSQL > 9.0.4' database with JDBC driver 'postgresql-9.0-801.jdbc4'. In my Java > program normal SELECT query didn't work. > ie,  > > try { >             Class.forName("org.postgresql.Driver"); >             connection =

Re: [GENERAL] Problem using PostgreSQL 9.0.4 with Java

2011-09-07 Thread John R Pierce
On 09/07/11 1:45 PM, Arun Nadar wrote: but it work by putting " ", like this SELECT "Id", "Name" FROM "Student" ORDER BY "Id"; in java String, inside of double inverted commas another is does not possible. String sql="SELECT \"Id\", \"Name\" FROM \"Student\" ORDER BY \"Id\""; Alternate

Re: [GENERAL] Demoting master to slave without an rsync...is it safe?

2011-09-07 Thread Chris Redekop
Yes, but I don't understand at all where this conversation is going, or how it's relevant. I have fail-over working perfectly fine.my original question was: is it safe to bring a former master back up as a slave without doing a base-backup first? (using recovery_target_timeline='latest') On

Re: [GENERAL] Demoting master to slave without an rsync...is it safe?

2011-09-07 Thread John R Pierce
On 09/07/11 2:43 PM, Chris Redekop wrote: my original question was: is it safe to bring a former master back up as a slave without doing a base-backup first? (using recovery_target_timeline='latest') no. you must first sync the new slave's files from the current master. if you can do this

Re: [GENERAL] Problem using PostgreSQL 9.0.4 with Java

2011-09-07 Thread David Johnston
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Arun Nadar Sent: Wednesday, September 07, 2011 4:45 PM To: pgsql-general@postgresql.org Subject: [GENERAL] Problem using PostgreSQL 9.0.4 with Java Hi but it work by putting " ", like this SEL

[GENERAL] pivoting data?

2011-09-07 Thread Joy Smith
I finally understand why the query looks like it does, even though it is not what I wanted. Here is the setup: Version "PostgreSQL 9.0.4, compiled by Visual C++ build 1500, 32-bit" Table Structure -- Table: modvalues --

[GENERAL] master-side counterpart of pg_last_xact_replay_timestamp?

2011-09-07 Thread Chris Redekop
Is there anything available to get the last time a transaction occurred?like say "pg_last_xact_timestamp"? In order to accurately calculate how far behind my slave is I need to do something like master::pg_last_xact_timestamp() - slave::pg_last_xact_replay_timestamp()currently I'm using no

Re: [GENERAL] pivoting data?

2011-09-07 Thread Chris Travers
On Wed, Sep 7, 2011 at 3:25 PM, Joy Smith wrote: > I finally understand why the query looks like it does, even though it is not > what I wanted.  Here is the setup: > > Version > > "PostgreSQL 9.0.4, compiled by Visual C++ build 1500, 32-bit" > > Table Structur

[GENERAL] 8.4 -> 9.0 upgrade difficulties

2011-09-07 Thread Steve Crawford
I am attempting to upgrade from 8.4 to 9.0 via parallel install of 9.0 along with 8.4. It isn't going well. Fortunately it's a dev/test machine I'm using as a test and practice space. The place I'm stuck is that "postgresql-server conflicts with postgresql90 (yum output at bottom). History:

[GENERAL] Lock problem

2011-09-07 Thread Eduardo Piombino
Hello list, I'm having a locking problem and I'm not sure what is causing it. I have two pgsql concurrent transactions, running each in a separate connection to postgres (I can reproduce it from pgadmin). T1) operates only on table A begin transaction; select id from A where id = 100 for update n

Re: [GENERAL] Lock problem

2011-09-07 Thread Tom Lane
Eduardo Piombino writes: > I don't see how a new update to the same record in A, makes the difference > to allow or deny the lock on a row on table B; I think it's probably explained by this: > PS: The only relation between A and B is that A has a two FKs to B, but none > of them are even includ

Re: [GENERAL] master-side counterpart of pg_last_xact_replay_timestamp?

2011-09-07 Thread Fujii Masao
On Thu, Sep 8, 2011 at 7:06 AM, Chris Redekop wrote: > Is there anything available to get the last time a transaction > occurred?like say "pg_last_xact_timestamp"? No. > In order to accurately > calculate how far behind my slave is I need to do something like > master::pg_last_xact_timestamp

Re: [GENERAL] master-side counterpart of pg_last_xact_replay_timestamp?

2011-09-07 Thread Simon Riggs
On Thu, Sep 8, 2011 at 6:43 AM, Fujii Masao wrote: > On Thu, Sep 8, 2011 at 7:06 AM, Chris Redekop wrote: >> Is there anything available to get the last time a transaction >> occurred?like say "pg_last_xact_timestamp"? > > No. > >> In order to accurately >> calculate how far behind my slave i

[GENERAL] Select Output in XML format

2011-09-07 Thread Adarsh Sharma
Dear all, Today I need to write the output of an postgres table into XML format. I think there is an easiest way to do this but not able to find it. In mysql there is simple query for that : mysql -X -e "select * from db_name.master" > /hdd2-1/test.xml In postgres , i find some XML data types