[HACKERS] [PATCH] Patch to fix a crash of psql

2012-11-29 Thread JiangGuiqing
hi When i test psql under multi-lingual and different encoding environment, I found a crash of psql. -- $ export PGCLIENTENCODING=SJIS $ psql psql (9.2rc1) Type help for help. postgres=# \i sql CREATE DATABASE You are now

Re: [HACKERS] WIP: index support for regexp search

2012-11-29 Thread er
On Mon, November 26, 2012 20:49, Alexander Korotkov wrote: trgm-regexp-0.6.patch.gz I ran the simple-minded tests against generated data (similar to the ones I did in January 2012). The problems of that older version seem pretty much all removed. (although I didn't do much work on it -- just

[HACKERS] Refactoring standby mode logic

2012-11-29 Thread Heikki Linnakangas
The code that reads the WAL from the archive, from pg_xlog, and from a master server via walreceiver, is quite complicated. I'm talking about the WaitForWALToBecomeAvailable() function in xlog.c. I got frustrated with that while working on the switching timeline over streaming replication

Re: [HACKERS] [PATCH] Patch to fix a crash of psql

2012-11-29 Thread Tatsuo Ishii
I confirmed the problem. Also I confirmed your patch fixes the problem. In addition to this, all the tests in test/mb and test/regress are passed. -- Tatsuo Ishii SRA OSS, Inc. Japan English: http://www.sraoss.co.jp/index_en.php Japanese: http://www.sraoss.co.jp hi When i test psql under

Re: [HACKERS] Bugs in CREATE/DROP INDEX CONCURRENTLY

2012-11-29 Thread Amit Kapila
On Thursday, November 29, 2012 12:39 AM Tom Lane wrote. Andres Freund and...@2ndquadrant.com writes: On 2012-11-27 23:46:58 -0500, Tom Lane wrote: Attached is a very preliminary draft patch for this. I've not addressed the question of whether we can clear indcheckxmin during

Re: [HACKERS] Bugs in CREATE/DROP INDEX CONCURRENTLY

2012-11-29 Thread Andres Freund
On 2012-11-29 16:18:07 +0530, Amit Kapila wrote: On Thursday, November 29, 2012 12:39 AM Tom Lane wrote. Andres Freund and...@2ndquadrant.com writes: On 2012-11-27 23:46:58 -0500, Tom Lane wrote: Attached is a very preliminary draft patch for this. I've not addressed the question of

Re: [HACKERS] Bugs in CREATE/DROP INDEX CONCURRENTLY

2012-11-29 Thread Amit Kapila
On Thursday, November 29, 2012 4:24 PM Andres Freund wrote: On 2012-11-29 16:18:07 +0530, Amit Kapila wrote: On Thursday, November 29, 2012 12:39 AM Tom Lane wrote. Andres Freund and...@2ndquadrant.com writes: On 2012-11-27 23:46:58 -0500, Tom Lane wrote: Attached is a very

[HACKERS] Patch to fix ecpg core dump with nested structure pointer variable

2012-11-29 Thread Muhammad Usama
Hi I have bumped in the segmentation fault in ecpg when using pointer to nested structure variable. ecpg crash.pgc Segmentation fault: 11 Please see the attached patch for the fix and test case to reproduce the scenario. Thanks Regards Muhammad Usama crash.pgc Description: Binary data

Re: [HACKERS] WIP: index support for regexp search

2012-11-29 Thread Heikki Linnakangas
One thing that bothers me with this algoritm is that the overflow mechanism is all-or-nothing. In many cases, even when there is a huge number of states in the diagram, you could still extract at least a few trigrams that must be present in any matching string, with little effort. At least, it

[HACKERS] [PATCH] make -jN check fails / unset MAKEFLAGS in pg_regress.c

2012-11-29 Thread Andres Freund
Hi, Currently make -jN check fails during creating temporary installation with: make[1]: *** read jobs pipe: Invalid argument. Stop. make[1]: *** Waiting for unfinished jobs make[2]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule. in install.log. This is due to

Re: [HACKERS] json accessors

2012-11-29 Thread Andrew Dunstan
On 11/28/2012 08:16 PM, Hannu Krosing wrote: On 11/29/2012 02:07 AM, Hannu Krosing wrote: On 11/29/2012 01:10 AM, Merlin Moncure wrote: On Wed, Nov 28, 2012 at 2:44 PM, Andrew Dunstan and...@dunslane.net wrote: ... *) have you considered something like anyelement from_json(anyelement,

Re: [HACKERS] [COMMITTERS] pgsql: Refactor flex and bison make rules

2012-11-29 Thread Jeremy Drake
On Wed, 28 Nov 2012, Tom Lane wrote: Andrew Dunstan and...@dunslane.net writes: On 11/28/2012 02:14 PM, Alvaro Herrera wrote: Okapi has been failing sporadically on ecpg, and I wonder if it's related to this change. Well, it looks like the make is broken and missing a clear dependency

Re: [HACKERS] [COMMITTERS] pgsql: Refactor flex and bison make rules

2012-11-29 Thread Jeremy Drake
On Wed, 28 Nov 2012, Tom Lane wrote: Jeremy Drake pgbuildf...@jdrake.com writes: While we're talking about odd issues that only seem to happen on Okapi, does anyone know of anything I can do to diagnose the pg_upgrade failure on the 9.2 branch? There are no rogue (non-buildfarm-related)

Re: [HACKERS] autovacuum truncate exclusive lock round two

2012-11-29 Thread Jan Wieck
On 11/28/2012 3:33 PM, Kevin Grittner wrote: Kevin Grittner wrote: I still need to review the timing calls, since I'm not familiar with them so it wasn't immediately obvious to me whether they were being used correctly. I have no reason to believe that they aren't, but feel I should check.

Re: [HACKERS] autovacuum truncate exclusive lock round two

2012-11-29 Thread Tom Lane
Jan Wieck janwi...@yahoo.com writes: On 11/28/2012 3:33 PM, Kevin Grittner wrote: Resetting starttime this way seems especially odd. instr_time is LARGE_INTEGER on Win32 but struct timeval on Unix. Is starttime = currenttime; portable if those are structs? Sure. We rely on struct

Re: [HACKERS] autovacuum truncate exclusive lock round two

2012-11-29 Thread Jan Wieck
On 11/29/2012 9:46 AM, Tom Lane wrote: Jan Wieck janwi...@yahoo.com writes: On 11/28/2012 3:33 PM, Kevin Grittner wrote: Resetting starttime this way seems especially odd. instr_time is LARGE_INTEGER on Win32 but struct timeval on Unix. Is starttime = currenttime; portable if those are

Re: [HACKERS] foreign key locks

2012-11-29 Thread Alvaro Herrera
Kevin Grittner wrote: Kevin Grittner wrote: Alvaro Herrera wrote: Here's version 24. This no longer applies after the rmgr rm_desc patch. I took a shot at merging those so I could review the patch against HEAD; attached in hopes that it will be useful. Hopefully this isn't too

Re: [HACKERS] [PATCH] binary heap implementation

2012-11-29 Thread Robert Haas
On Wed, Nov 28, 2012 at 3:21 PM, Andres Freund and...@2ndquadrant.com wrote: Looks ready to me. Committed. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: [HACKERS] [COMMITTERS] pgsql: Refactor flex and bison make rules

2012-11-29 Thread Andrew Dunstan
On 11/28/2012 11:03 PM, Tom Lane wrote: Jeremy Drake pgbuildf...@jdrake.com writes: While we're talking about odd issues that only seem to happen on Okapi, does anyone know of anything I can do to diagnose the pg_upgrade failure on the 9.2 branch? There are no rogue (non-buildfarm-related)

Re: [HACKERS] Patch to fix ecpg core dump with nested structure pointer variable

2012-11-29 Thread Michael Meskes
I have bumped in the segmentation fault in ecpg when using pointer to nested structure variable. ... Please see the attached patch for the fix and test case to reproduce the scenario. Thanks for spotting and fixing this. Patch committed to git. Michael -- Michael Meskes Michael at

[HACKERS] Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: On 11/28/2012 11:03 PM, Tom Lane wrote: [ digs around ... ] It looks like the failure is coming from here: if (strlen(path) = sizeof(unp-sun_path)) return EAI_FAIL; Looks like it was. Good catch. What's the best way to fix? So

Re: [HACKERS] Bugs in CREATE/DROP INDEX CONCURRENTLY

2012-11-29 Thread Tom Lane
And here is a version for 9.1. This omits the code changes directly relevant to DROP INDEX CONCURRENTLY, but includes the changes to avoid transactional updates of the pg_index row during CREATE CONCURRENTLY, as well as the changes to prevent use of not-valid or not-ready indexes in places where

Re: [HACKERS] Further pg_upgrade analysis for many tables

2012-11-29 Thread Bruce Momjian
On Wed, Nov 28, 2012 at 03:22:32PM -0500, Bruce Momjian wrote: On Tue, Nov 27, 2012 at 09:35:10PM -0800, Jeff Janes wrote: I tested custom format with pg_restore -j and -1, as well as text restore. The winner was pg_dump -Fc | pg_restore -1; I don't have the numbers at hand, but if my

Re: [HACKERS] json accessors

2012-11-29 Thread Merlin Moncure
On Thu, Nov 29, 2012 at 7:58 AM, Andrew Dunstan and...@dunslane.net wrote: On 11/28/2012 08:16 PM, Hannu Krosing wrote: You could even do a template-less row_from_json which returns a records with all fields converted to the JSON-encodable types and hope that the next conversions will be done

Re: [HACKERS] json accessors

2012-11-29 Thread Andrew Dunstan
On 11/29/2012 01:06 PM, Merlin Moncure wrote: so, just hashing out your proposal and making sure it's reasonable analogous implementation of xpath. Sleeping on it, I say mostly, but not quite. how about some changes for json_get: 1) return setof (key, value) in the style of jquery each(). 2)

Re: [HACKERS] foreign key locks - EvalPlanQual interactions

2012-11-29 Thread Andres Freund
On 2012-11-27 12:07:34 -0300, Alvaro Herrera wrote: Alvaro Herrera wrote: Here's version 24. Old review emails still contains some items that didn't lead to any changes. I tried to keep close track of those. To that list I add a couple of things of my own. Here they are, for those

Re: [HACKERS] Bugs in CREATE/DROP INDEX CONCURRENTLY

2012-11-29 Thread Andres Freund
On 2012-11-29 11:53:50 -0500, Tom Lane wrote: And here is a version for 9.1. This omits the code changes directly relevant to DROP INDEX CONCURRENTLY, but includes the changes to avoid transactional updates of the pg_index row during CREATE CONCURRENTLY, as well as the changes to prevent use

Re: [HACKERS] Enabling frontend-only xlog desc routines

2012-11-29 Thread Tom Lane
Alvaro Herrera alvhe...@2ndquadrant.com writes: The other interesting question remaining is what to do about the rm_desc function in rmgr.c. We're split between these two ideas: Why try to link rmgr.c into frontend versions at all? Just make a new table file that only includes the desc

Re: [HACKERS] Enabling frontend-only xlog desc routines

2012-11-29 Thread Andres Freund
On 2012-11-29 15:03:48 -0500, Tom Lane wrote: Alvaro Herrera alvhe...@2ndquadrant.com writes: The other interesting question remaining is what to do about the rm_desc function in rmgr.c. We're split between these two ideas: Why try to link rmgr.c into frontend versions at all? Just make

Re: [HACKERS] Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Tom Lane
I wrote: Andrew Dunstan and...@dunslane.net writes: Looks like it was. Good catch. What's the best way to fix? So far as I can see, none of the spec-defined EAI_XXX codes map very nicely to path name too long. Possibly we could return EAI_SYSTEM and set errno to ENAMETOOLONG, but I'm not

Re: [HACKERS] Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Andrew Dunstan
On 11/29/2012 03:33 PM, Tom Lane wrote: I wrote: Andrew Dunstan and...@dunslane.net writes: Looks like it was. Good catch. What's the best way to fix? So far as I can see, none of the spec-defined EAI_XXX codes map very nicely to path name too long. Possibly we could return EAI_SYSTEM and

[HACKERS] missing LockBuffer(buffer, BUFFER_LOCK_SHARE) in trigger.c GetTupleForTrigger?

2012-11-29 Thread Andres Freund
Hi, while looking at trigger.c from the POV of foreign key locks I noticed that GetTupleForTrigger commentless assumes it can just look at a pages content without a LockBuffer(buffer, BUFFER_LOCK_SHARE); That code path is only reached for AFTER ... FOR EACH ROW ... triggers, so its fine it's

Re: [HACKERS] json accessors

2012-11-29 Thread Merlin Moncure
On Thu, Nov 29, 2012 at 1:19 PM, Andrew Dunstan and...@dunslane.net wrote: On 11/29/2012 01:06 PM, Merlin Moncure wrote: so, just hashing out your proposal and making sure it's reasonable analogous implementation of xpath. Sleeping on it, I say mostly, but not quite. how about some changes

Re: [HACKERS] Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: On 11/29/2012 03:33 PM, Tom Lane wrote: Another line of attack is to just teach getaddrinfo_unix() to malloc its result struct big enough to hold whatever the supplied path is. I tried this out too, and found that it doesn't work well, because both

[HACKERS] Re: Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Noah Misch
On Thu, Nov 29, 2012 at 03:33:59PM -0500, Tom Lane wrote: I wrote: So far as I can see, none of the spec-defined EAI_XXX codes map very nicely to path name too long. Possibly we could return EAI_SYSTEM and set errno to ENAMETOOLONG, but I'm not sure the latter is very portable either.

Re: [HACKERS] Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Tom Lane
Noah Misch n...@leadboat.com writes: Linux enforces a hard limit matching the static buffer in sockaddr_un. You'd proceed a bit further and hit could not bind Unix socket: Invalid argument or some such. Hm, I was wondering about that. The Single Unix Spec suggests that bind/connect ought to

Re: [HACKERS] Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Andrew Dunstan
On 11/29/2012 05:20 PM, Tom Lane wrote: I don't think it's worth a heroic effort. Meanwhile I'll add a check in the upgrade test module(s) to check for overly long paths likely to give problems. I'm thinking maybe we should try to fix this. What's bugging me is that Jeremy's build path

Re: [HACKERS] Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: ... Or maybe the postmaster needs to check the length somehow before it calls StreamServerPort() so we can give a saner error message. Hm. That's ugly, but a lot less invasive than trying to get the official API to pass the information through.

Re: [HACKERS] Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Andrew Dunstan
On 11/29/2012 06:23 PM, Tom Lane wrote: Andrew Dunstan and...@dunslane.net writes: ... Or maybe the postmaster needs to check the length somehow before it calls StreamServerPort() so we can give a saner error message. Hm. That's ugly, but a lot less invasive than trying to get the official

Re: [HACKERS] json accessors

2012-11-29 Thread Merlin Moncure
On Thu, Nov 29, 2012 at 4:14 PM, Andrew Dunstan and...@dunslane.net wrote: There are many things wrong with this. First, converting to hstore so you can call populate_record is quite horrible and ugly and inefficient. And it's dependent on having hstore loaded - you can't have an hstore_to_jon

Re: [HACKERS] Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: On 11/29/2012 06:23 PM, Tom Lane wrote: However, that's only addressing the reporting end of it; I think we also need to change the pg_upgrade test script as suggested by Noah. The test script doesn't do anything. It's pg_upgrade itself that sets

Re: [HACKERS] Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Tom Lane
Tom Lane t...@sss.pgh.pa.us writes: Andrew Dunstan and...@dunslane.net writes: ... Or maybe the postmaster needs to check the length somehow before it calls StreamServerPort() so we can give a saner error message. Hm. That's ugly, but a lot less invasive than trying to get the official

Re: [HACKERS] Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Andrew Dunstan
On 11/29/2012 07:16 PM, Tom Lane wrote: Andrew Dunstan and...@dunslane.net writes: On 11/29/2012 06:23 PM, Tom Lane wrote: However, that's only addressing the reporting end of it; I think we also need to change the pg_upgrade test script as suggested by Noah. The test script doesn't do

Re: [HACKERS] Overlength socket paths (was Re: [COMMITTERS] pgsql: Refactor flex and bison make rules)

2012-11-29 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: On 11/29/2012 07:16 PM, Tom Lane wrote: Um ... that's *another* place that needs to change then, because the test script fires up postmasters on its own, outside of pg_upgrade. True, but it doesn't do anything about setting the socket dir, so those

Re: [HACKERS] Bugs in CREATE/DROP INDEX CONCURRENTLY

2012-11-29 Thread Michael Paquier
On Fri, Nov 30, 2012 at 4:43 AM, Andres Freund and...@2ndquadrant.comwrote: On 2012-11-29 11:53:50 -0500, Tom Lane wrote: And here is a version for 9.1. This omits the code changes directly relevant to DROP INDEX CONCURRENTLY, but includes the changes to avoid transactional updates of the

Re: [HACKERS] missing LockBuffer(buffer, BUFFER_LOCK_SHARE) in trigger.c GetTupleForTrigger?

2012-11-29 Thread Pavan Deolasee
On Fri, Nov 30, 2012 at 3:19 AM, Andres Freund and...@2ndquadrant.comwrote: Hi, while looking at trigger.c from the POV of foreign key locks I noticed that GetTupleForTrigger commentless assumes it can just look at a pages content without a LockBuffer(buffer, BUFFER_LOCK_SHARE); That

Re: [HACKERS] initdb.c::main() too large

2012-11-29 Thread Tom Lane
Bruce Momjian br...@momjian.us writes: In looking to add an fsync-only option to initdb, I found its main() function to be 743 lines long, and very hard to understand. The attached patch moves much of that code into separate functions, which will make initdb.c easier to understand, and easier

Re: [HACKERS] [PATCH] Patch to fix a crash of psql

2012-11-29 Thread Tatsuo Ishii
1. some especial character (my sql file contains japanese comment -- コメント . It can cause psql crash.) 2. PGCLIENTENCODING is SJIS 3. the encoding of input sql file is UTF-8 Actually the problem can occur even when importing following 3 byte UTF8 input file: ト (in hexa, 0xe3, 0x83, 0x88)

Re: [HACKERS] [PATCH] Patch to fix a crash of psql

2012-11-29 Thread JiangGuiqing
buffer lenghth). So my proposal is, if prepare_buffer() detects possible inconsistency between buffer encoding and file encoding, warn user. I agree with that. On 2012/11/30 12:52, Tatsuo Ishii Wrote: 1. some especial character (my sql file contains japanese comment -- コメント . It can cause

Re: [HACKERS] PQconninfo function for libpq

2012-11-29 Thread Magnus Hagander
On Wed, Nov 28, 2012 at 7:01 AM, Magnus Hagander mag...@hagander.net wrote: On Nov 28, 2012 1:54 AM, Tom Lane t...@sss.pgh.pa.us wrote: Alvaro Herrera alvhe...@2ndquadrant.com writes: Peter Eisentraut wrote: There is already the PQconninfoOption.dispchar field for this purpose. I had