Re: [GENERAL] Commit problem in read-commited isolation level

2013-08-15 Thread S H
> Any triggers on the table? There are no trigger associated with this table. > FYI 8.1 is no longer supported. I understand that. If there are some known related issues, it will be easy to convince, Product mgmt team to upgrade the version of postgresql. Are there known issues related to commi

Re: [GENERAL] devide and summarize sql result (all)

2013-08-15 Thread Beena Emerson
Hi Janek, You can try: =# SELECT name, perc/5*5 || '-' || perc/5*5+5 AS range, count(*) as matches FROM test GROUP BY name, perc/5 ORDER BY perc/5; name | range | matches ---++- franz | 75-80 | 1 jason | 75-80 | 1 franz | 80-85 | 1 smith | 85-90 |

[GENERAL] Forcing materialize in the planner

2013-08-15 Thread Robert James
I have a query which, when I materialize by hand some of its components, runs 10x faster (including the time needed to materialize). Is there any way to force Postgres to do that? Or do I need to do this by hand using temp tables? -- Sent via pgsql-general mailing list (pgsql-general@postgresql

Re: [GENERAL] Escape string for LIKE op

2013-08-15 Thread Robert James
On 8/15/13, Jeff Janes wrote: > On Thu, Aug 15, 2013 at 1:16 PM, Robert James > wrote: >> How can I escape a string for LIKE operations? >> >> I want to do: >> >> SELECT * FROM t WHERE a LIKE b || '%' >> >> But I want be to interpreted literally. If b is 'The 7% Solution', I >> don't want that '

Re: [GENERAL] devide and summarize sql result (all)

2013-08-15 Thread bricklen
On Thu, Aug 15, 2013 at 1:51 PM, Janek Sendrowski wrote: > Hi, > > My sql query results sth. like this: > > user percentage > franz 78% > smith 98% > franz 81% > jason 79% > smith 89% > smith 85% > smith 99% > > Now I'd like to summarize the percentages oder every user like this. > smith > 2 matc

Re: [GENERAL] Escape string for LIKE op

2013-08-15 Thread Vik Fearing
On 08/15/2013 10:16 PM, Robert James wrote: > How can I escape a string for LIKE operations? > > I want to do: > > SELECT * FROM t WHERE a LIKE b || '%' > > But I want be to interpreted literally. If b is 'The 7% Solution', I > don't want that '%' to be wildcard. I can't find an appropriate > fun

Re: [GENERAL] Strange result with "SELECT ... ORDER BY random() LIMIT 1" and JOINs

2013-08-15 Thread Adrian Klaver
On 08/15/2013 11:46 AM, Etienne Dube wrote: Hello, I don't really understand what is going on there, the result appears incorrect to me. The following page seems to offer some explanations as to what is happening: http://sql-info.de/postgresql/postgres-gotchas.html#1_6 . Indeed, adding OFFSET

[GENERAL] devide and summarize sql result (all)

2013-08-15 Thread Janek Sendrowski
Hi,   My sql query results sth. like this:   user percentage franz 78% smith 98% franz 81% jason 79% smith 89% smith 85% smith 99%   Now I'd like to summarize the percentages oder every user like this. smith 2 matches 95-100% 2 matches 85-95% 0 mathes 75-85%   franz 0 mathes 95-100% ..

[GENERAL] devide and summarize sql result

2013-08-15 Thread Janek Sendrowski
Hi,   My sql query results sth. like this:   user percentage franz 78% smith 98% franz 81% jason -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Escape string for LIKE op

2013-08-15 Thread Jeff Janes
On Thu, Aug 15, 2013 at 1:16 PM, Robert James wrote: > How can I escape a string for LIKE operations? > > I want to do: > > SELECT * FROM t WHERE a LIKE b || '%' > > But I want be to interpreted literally. If b is 'The 7% Solution', I > don't want that '%' to be wildcard. I can't find an appropr

Re: [GENERAL] Streaming Replication Randomly Locking Up

2013-08-15 Thread Andrew Berman
Hi Jeff, Here is the full process list at the time it stopped working (I have changed the actual username, db and IP for security). Would the idle in transaction process be the culprit? postgres 5639 0.1 24.3 3428264 2970236 ? Ss Aug14 1:54 postgres: startup process recovering 00

Re: [GENERAL] Streaming Replication Randomly Locking Up

2013-08-15 Thread Jeff Janes
On Thu, Aug 15, 2013 at 11:07 AM, Andrew Berman wrote: > Hello, > > I'm having an issue where streaming replication just randomly stops working. > I haven't been able to find anything in the logs which point to an issue, > but the Postgres process shows a "waiting" status on the slave: > > postgre

Re: [GENERAL] Immediate Constraints

2013-08-15 Thread Darren Duncan
From a logical standpoint, its like this. The purpose of constraints is to have the DBMS enforce your concept of consistency, wherein a database is consistent if any questions you ask it result in a valid answer insofar as the database could possibly know. Immediate constraints ensure that th

[GENERAL] Escape string for LIKE op

2013-08-15 Thread Robert James
How can I escape a string for LIKE operations? I want to do: SELECT * FROM t WHERE a LIKE b || '%' But I want be to interpreted literally. If b is 'The 7% Solution', I don't want that '%' to be wildcard. I can't find an appropriate function to escape it and any other potential wildcards for LI

Re: [GENERAL] Streaming Replication Randomly Locking Up

2013-08-15 Thread Andrew Berman
Yep, that's the first thing I'm going to do. On Thu, Aug 15, 2013 at 12:34 PM, Lonni J Friedman wrote: > I'd suggest enhancing your logging to include time/datestamps for > every entry, and also the client hostname. That will help to rule > in/out those 'unexpected EOF' errors. > > On Thu, Aug

Re: [GENERAL] Streaming Replication Randomly Locking Up

2013-08-15 Thread Lonni J Friedman
I'd suggest enhancing your logging to include time/datestamps for every entry, and also the client hostname. That will help to rule in/out those 'unexpected EOF' errors. On Thu, Aug 15, 2013 at 12:22 PM, Andrew Berman wrote: > The only thing I see that is a possibility for the issue is in the sl

Re: [GENERAL] Streaming Replication Randomly Locking Up

2013-08-15 Thread Andrew Berman
The only thing I see that is a possibility for the issue is in the slave log: LOG: unexpected EOF on client connection LOG: could not receive data from client: Connection reset by peer I don't know if that's related or not as it could just be somebody running a query. The log file does seem to

Re: [GENERAL] Streaming Replication Randomly Locking Up

2013-08-15 Thread Lonni J Friedman
Are you certain that there are no relevant errors in the database logs (on both master & slave)? Also, are you sure that you didn't misconfigure logging such that errors wouldn't appear? On Thu, Aug 15, 2013 at 11:45 AM, Andrew Berman wrote: > Hi Lonni, > > Yes, I am using PG 9.1.9. > Yes, 1 sla

[GENERAL] Strange result with "SELECT ... ORDER BY random() LIMIT 1" and JOINs

2013-08-15 Thread Etienne Dube
Hello, Consider the following tables and data: CREATE TABLE color ( color_id integer PRIMARY KEY, color_name text ); INSERT INTO color (color_id, color_name) VALUES (1, 'red'), (2, 'blue'), (3, 'green'), (4, 'yellow'), (5, 'gr

Re: [GENERAL] Streaming Replication Randomly Locking Up

2013-08-15 Thread Andrew Berman
Hi Lonni, Yes, I am using PG 9.1.9. Yes, 1 slave syncing from the master CentOS 6.4 I don't see any network or hardware issues (e.g. NIC) but will look more into this. They are communicating on a private network and switch. I forgot to mention that after I restart the slave, everything syncs rig

Re: [GENERAL] Streaming Replication Randomly Locking Up

2013-08-15 Thread Lonni J Friedman
I've never seen this happen. Looks like you might be using 9.1? Are you up to date on all the 9.1.x releases? Do you have just 1 slave syncing from the master? Which OS are you using? Did you verify that there aren't any network problems between the slave & master? Or hardware problems (like the

[GENERAL] Streaming Replication Randomly Locking Up

2013-08-15 Thread Andrew Berman
Hello, I'm having an issue where streaming replication just randomly stops working. I haven't been able to find anything in the logs which point to an issue, but the Postgres process shows a "waiting" status on the slave: postgres 5639 0.1 24.3 3428264 2970236 ? Ss Aug14 1:54 postgres:

Re: [GENERAL] MinGW compiled client library

2013-08-15 Thread Michael Cronenworth
On 08/15/2013 10:59 AM, Michael Cronenworth wrote: > The attached patches resolve the issue. Should I forward the patches on to the pgsql-hackers list for review or is this list sufficient? (First time PostgreSQL hacker.) -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To

Re: [GENERAL] SSL connection has been closed unexpectedly

2013-08-15 Thread Adrian Klaver
On 08/15/2013 10:05 AM, Stuart Ford wrote: Guy No, we don't. It's also not happening on another platform which uses the same switch stack (and indeed VMWare cluster), so these aren't factors. For completeness sake: When you reset the SSL values did you restart the server? Left field category

Re: [GENERAL] SSL connection has been closed unexpectedly

2013-08-15 Thread Stuart Ford
Guy No, we don't. It's also not happening on another platform which uses the same switch stack (and indeed VMWare cluster), so these aren't factors. Stuart On 15/08/2013 16:59, "Guy Helmer" wrote: >On Aug 15, 2013, at 5:41 AM, Stuart Ford wrote: > >> Dear community >> >> We have a problem on

Re: [GENERAL] Debugging Postgres?

2013-08-15 Thread Steve Crawford
On 08/13/2013 01:51 PM, Barth Weishoff wrote: Hello I'm having an interesting issue with PGSQL. It seems that I'm experiencing timeouts at various times. The servers are not busy and have plenty of resources. The databases are ~50GB in size, the systems typically have 8-12GB physical

[GENERAL] Immediate Constraints

2013-08-15 Thread Perry Smith
The direct question is: what is the advantage of an immediate constraint? My habit is to add constraints to my databases and my first lesson was to make them "deferrable". But a recent fight with pg_restore taught me that to do a pg_restore that is complex, you need to defer the constraints. I

Re: [GENERAL] MinGW compiled client library

2013-08-15 Thread Michael Cronenworth
On 08/13/2013 12:35 PM, Michael Cronenworth wrote: > When the client library (version 9.2.x) is compiled with a MinGW-w64 > environment > the resulting libpq.dll will not function. This has been reported previously > with two bug reports, which have gone untouched. > > Bug 8151: > http://www.post

Re: [GENERAL] Why doesn't COPY support the HEADER options for tab-separated output?

2013-08-15 Thread Jeff Janes
On Thu, Aug 15, 2013 at 1:25 AM, Richard Huxton wrote: > On 12/08/13 23:18, Bruce Momjian wrote: >> >> On Mon, Aug 12, 2013 at 03:17:00PM -0700, Jeff Janes wrote: >>> >>> On Mon, Aug 12, 2013 at 2:21 PM, Bruce Momjian wrote: On Mon, Aug 12, 2013 at 02:15:25PM -0700, Joe Van Dyk wrote: >

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Alban Hertroys
On 15 August 2013 17:33, Ivan Radovanovic wrote: > On 08/15/13 17:27, Adrian Klaver napisa: > > Actually you can: >> >> CREATE TABLE bytea_test(id int, fld_1 bytea); >> >> test=# \d bytea_test >> >> Table "public.bytea_test" >> >> Column | Type | Modifiers >> +-+--- >> id

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Ivan Radovanovic
On 08/15/13 17:27, Adrian Klaver napisa: On 08/15/2013 08:07 AM, Ivan Radovanovic wrote: On 08/15/13 16:59, Adrian Klaver napisa: On 08/15/2013 07:53 AM, Ivan Radovanovic wrote: Now I just need to find out which types can be indexed (and which types can be part of PK) http://www.postgresql

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Adrian Klaver
On 08/15/2013 08:07 AM, Ivan Radovanovic wrote: On 08/15/13 16:59, Adrian Klaver napisa: On 08/15/2013 07:53 AM, Ivan Radovanovic wrote: Now I just need to find out which types can be indexed (and which types can be part of PK) http://www.postgresql.org/docs/9.2/interactive/indexes.html

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Ivan Radovanovic
On 08/15/13 17:15, Tom Lane napisa: Ivan Radovanovic writes: Thanks Adrian, but question was how to decide which types are indexable A little bit of research in the system-catalogs documentation will show you how to find the types that can be accepted by some index opclass (hint: "pg_opclass.

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Tom Lane
Ivan Radovanovic writes: > Thanks Adrian, but question was how to decide which types are indexable A little bit of research in the system-catalogs documentation will show you how to find the types that can be accepted by some index opclass (hint: "pg_opclass.opcintype::regtype"). As far as the

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Ivan Radovanovic
On 08/15/13 16:59, Adrian Klaver napisa: On 08/15/2013 07:53 AM, Ivan Radovanovic wrote: Now I just need to find out which types can be indexed (and which types can be part of PK) http://www.postgresql.org/docs/9.2/interactive/indexes.html doesn't list which types can be indexed and which

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Adrian Klaver
On 08/15/2013 07:53 AM, Ivan Radovanovic wrote: Now I just need to find out which types can be indexed (and which types can be part of PK) http://www.postgresql.org/docs/9.2/interactive/indexes.html doesn't list which types can be indexed and which can't? Postgres can handle a variety of

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Ivan Radovanovic
On 08/15/13 16:49, Adrian Klaver napisa: On 08/15/2013 07:37 AM, Ivan Radovanovic wrote: On 08/15/13 16:30, Adrian Klaver napisa: On 08/15/2013 02:33 AM, Ivan Radovanovic wrote: On 08/15/13 05:23, Michael Paquier napisa: On Thu, Aug 15, 2013 at 6:00 AM, Bruce Momjian wrote: Try psql -E, and

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Adrian Klaver
On 08/15/2013 07:37 AM, Ivan Radovanovic wrote: On 08/15/13 16:30, Adrian Klaver napisa: On 08/15/2013 02:33 AM, Ivan Radovanovic wrote: On 08/15/13 05:23, Michael Paquier napisa: On Thu, Aug 15, 2013 at 6:00 AM, Bruce Momjian wrote: Try psql -E, and run the \dT command to see the query it us

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Ivan Radovanovic
On 08/15/13 16:30, Adrian Klaver napisa: On 08/15/2013 02:33 AM, Ivan Radovanovic wrote: On 08/15/13 05:23, Michael Paquier napisa: On Thu, Aug 15, 2013 at 6:00 AM, Bruce Momjian wrote: Try psql -E, and run the \dT command to see the query it uses. You have also the following commands: - ¥dT+

Re: [GENERAL] vacuumdb uses a lot of disk

2013-08-15 Thread Kevin Grittner
Alexander Shutyaev wrote: > We have the following issue. When we use vacuumdb (NOT full) on > our postgres database (~320Gb) it takes up ~10Gb of disk space > which is never returned. Why is the space not returned? Does that happen every time?  (i.e., if you run vacuumdb 10 times in a row while

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Adrian Klaver
On 08/15/2013 02:33 AM, Ivan Radovanovic wrote: On 08/15/13 05:23, Michael Paquier napisa: On Thu, Aug 15, 2013 at 6:00 AM, Bruce Momjian wrote: Try psql -E, and run the \dT command to see the query it uses. You have also the following commands: - ¥dT+, all types with addition information lik

Re: [GENERAL] What type of index do I need for this JOIN?

2013-08-15 Thread Kevin Grittner
Robert James wrote: > On 8/14/13, Kevin Grittner wrote: >> Robert James wrote: >> >>> I'm confused: What's the difference between >>>   col LIKE  'foo%' >>> and >>>   col LIKE f1 || '%' >>> ? >> >> The planner knows that 'foo%' doesn't start with a wildcard. >> >>> Either way, it's anchored to t

[GENERAL] last_vacuum field in not updated

2013-08-15 Thread AI Rumman
Hi, I am using Postgresql 9.2 where I have a table "table1". I used vacuum command in that table, but last_vacuum column of pg_stat_user_tables has not been updated. Any idea for it? \d table1 Table "public.table1" Column | Type | Modifiers --+--

Re: [GENERAL] SSL connection has been closed unexpectedly

2013-08-15 Thread Alban Hertroys
On 15 August 2013 15:29, Stuart Ford wrote: > Alban > > I would agree with you, except ...that you misread what I wrote ;) > it still happens even after I have disabled > all SSL related stuff in postgresql.conf and pg_hba.conf. Well, of course. Why would that make any difference? Your prob

Re: [GENERAL] SSL connection has been closed unexpectedly

2013-08-15 Thread Stuart Ford
Alban I would agree with you, except it still happens even after I have disabled all SSL related stuff in postgresql.conf and pg_hba.conf. I've also no evidence of any out of memory events on the server. Stuart -- From: Alban Hertroys Date: Thursday, 15 August 2013 13:31 To: Stuart Ford Cc

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Bruce Momjian
On Thu, Aug 15, 2013 at 11:33:42AM +0200, Ivan Radovanovic wrote: > On 08/15/13 05:23, Michael Paquier napisa: > >On Thu, Aug 15, 2013 at 6:00 AM, Bruce Momjian wrote: > >>Try psql -E, and run the \dT command to see the query it uses. > >You have also the following commands: > >- ¥dT+, all types w

Re: [GENERAL] SSL connection has been closed unexpectedly

2013-08-15 Thread Alban Hertroys
On 15 August 2013 12:41, Stuart Ford wrote: > Dear community > > We have a problem on our development database server, which supports a PHP > application, which connects to it from a different server. Sometimes, > around 1 in 4 page loads, it fails and reports the following error message: > > FAT

Re: [GENERAL] Why doesn't COPY support the HEADER options for tab-separated output?

2013-08-15 Thread Bruce Momjian
On Thu, Aug 15, 2013 at 09:25:07AM +0100, Richard Huxton wrote: > On 12/08/13 23:18, Bruce Momjian wrote: > >On Mon, Aug 12, 2013 at 03:17:00PM -0700, Jeff Janes wrote: > >>On Mon, Aug 12, 2013 at 2:21 PM, Bruce Momjian wrote: > >>>On Mon, Aug 12, 2013 at 02:15:25PM -0700, Joe Van Dyk wrote: > >>>

[GENERAL] SSL connection has been closed unexpectedly

2013-08-15 Thread Stuart Ford
Dear community We have a problem on our development database server, which supports a PHP application, which connects to it from a different server. Sometimes, around 1 in 4 page loads, it fails and reports the following error message: FATAL: terminating connection due to administrator command SS

Re: [GENERAL] Getting list of supported types in Postgres

2013-08-15 Thread Ivan Radovanovic
On 08/15/13 05:23, Michael Paquier napisa: On Thu, Aug 15, 2013 at 6:00 AM, Bruce Momjian wrote: Try psql -E, and run the \dT command to see the query it uses. You have also the following commands: - ¥dT+, all types with addition information like its size ('var' is for example variable length)

Re: [GENERAL] Why doesn't COPY support the HEADER options for tab-separated output?

2013-08-15 Thread Richard Huxton
On 12/08/13 23:18, Bruce Momjian wrote: On Mon, Aug 12, 2013 at 03:17:00PM -0700, Jeff Janes wrote: On Mon, Aug 12, 2013 at 2:21 PM, Bruce Momjian wrote: On Mon, Aug 12, 2013 at 02:15:25PM -0700, Joe Van Dyk wrote: Mostly just curious, as this is preventing me from using tab-separated output.