[HACKERS] Fix comment in xlog.c

2017-06-22 Thread Amit Langote
Attached a patch for $SUBJECT. - * If RecPtr is not NULL, try to read a record at that position. Otherwise + * If RecPtr is valid, try to read a record at that position. Otherwise Commit 4d6d425ab8d addressed the comment above XLogReadRecord() in xlogreader.c, but missed the same above

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2017-06-22 Thread Yugo Nagata
On Thu, 22 Jun 2017 09:24:54 +0900 Michael Paquier wrote: > On Wed, Jun 21, 2017 at 11:42 PM, Daniel Gustafsson wrote: > > The message is truncated in SetBackendCancelMessage() for safety, but > > pg_{cancel|terminate}_backend() could throw an error

Re: [HACKERS] Autovacuum launcher occurs error when cancelled by SIGINT

2017-06-22 Thread Michael Paquier
On Thu, Jun 22, 2017 at 2:44 PM, Kuntal Ghosh wrote: > On Thu, Jun 22, 2017 at 9:48 AM, Michael Paquier > wrote: >> On Thu, Jun 22, 2017 at 1:29 AM, Kuntal Ghosh >> wrote: >>> But, I've some more doubts. >>> 1.

[HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Kang Yuzhe
Dear PG hackers, First my apology if I appear to be a jerk or not following the policy. I emailed Boxuan Zhai who was in charge of the SQL Merge keyword in 2010 of GSoC but without reply. I want to apply merge_v201.patch to specific PG version. It failed saying 1 or 2 of 5 hunk failed. My

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Michael Paquier
On Thu, Jun 22, 2017 at 5:05 PM, Kang Yuzhe wrote: > First my apology if I appear to be a jerk or not following the policy. No problem. > I emailed Boxuan Zhai who was in charge of the SQL Merge keyword in > 2010 of GSoC but without reply. > > I want to apply

Re: [HACKERS] Setting pd_lower in GIN metapage

2017-06-22 Thread Michael Paquier
On Wed, Jun 21, 2017 at 9:42 AM, Amit Langote wrote: > On 2017/06/20 20:37, Amit Kapila wrote: >> On Tue, Jun 20, 2017 at 1:50 PM, Amit Langote >> wrote: >>> On 2017/06/19 23:31, Tom Lane wrote: I'd suggest a rule like "if

Re: [HACKERS] Autovacuum launcher occurs error when cancelled by SIGINT

2017-06-22 Thread Thomas Munro
On Thu, Jun 22, 2017 at 6:10 PM, Michael Paquier wrote: > On Thu, Jun 22, 2017 at 2:44 PM, Kuntal Ghosh > wrote: >> On Thu, Jun 22, 2017 at 9:48 AM, Michael Paquier >> wrote: >>> On Thu, Jun 22, 2017 at 1:29 AM,

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Kang Yuzhe
On Thu, Jun 22, 2017 at 11:16 AM, Michael Paquier wrote: > On Thu, Jun 22, 2017 at 5:05 PM, Kang Yuzhe wrote: >> First my apology if I appear to be a jerk or not following the policy. > > No problem. > >> I emailed Boxuan Zhai who was in charge

Re: [HACKERS] Get stuck when dropping a subscription during synchronizing table

2017-06-22 Thread Masahiko Sawada
On Wed, Jun 21, 2017 at 8:10 AM, Peter Eisentraut wrote: > On 6/19/17 22:54, Masahiko Sawada wrote: >>> It seems to me we could just take a stronger lock around >>> RemoveSubscriptionRel(), so that workers can't write in there concurrently. >> >> Since we reduced

Re: [HACKERS] Get stuck when dropping a subscription during synchronizing table

2017-06-22 Thread Kyotaro HORIGUCHI
Hello, At Wed, 21 Jun 2017 22:43:32 -0400, Peter Eisentraut wrote in <501f75c9-c5d6-d023-add0-3b670ac86...@2ndquadrant.com> > On 6/20/17 19:10, Peter Eisentraut wrote: > > On 6/19/17 22:54, Masahiko Sawada wrote: > >>> It seems to me we could just take a

Re: [HACKERS] kqueue

2017-06-22 Thread Thomas Munro
On Tue, Oct 11, 2016 at 8:08 PM, Torsten Zuehlsdorff wrote: > On 28.09.2016 23:39, Thomas Munro wrote: >> It's difficult to draw any conclusions at this point. > > I'm currently setting up a new FreeBSD machine. Its a FreeBSD 11 with ZFS, > 64 GB RAM and Quad Core.

[HACKERS] pg_stop_backup(wait_for_archive := true) on standby server

2017-06-22 Thread Masahiko Sawada
Hi, Since an optional second argument wait_for_archive of pg_stop_backup has been introduced in PostgreSQL 10 we can choose whether wait for archiving. But my colleagues found that we can do pg_stop_backup with wait_for_archive = true on the standby server but it actually doesn't wait for WAL

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Craig Ringer
On 22 June 2017 at 16:05, Kang Yuzhe wrote: > Dear PG hackers, > > First my apology if I appear to be a jerk or not following the policy. > > I emailed Boxuan Zhai who was in charge of the SQL Merge keyword in > 2010 of GSoC but without reply. > > I want to apply

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Thomas Munro
On Thu, Jun 22, 2017 at 9:00 PM, Kang Yuzhe wrote: > I just downloaded the patch from GSoC site. I just looked at https://wiki.postgresql.org/wiki/Add_MERGE_command_GSoC_2010 and saw that the file https://wiki.postgresql.org/wiki/File:Merge_v201.tar was uploaded on 24 Aug

Re: [HACKERS] Incorrect documentation about pg_stat_activity

2017-06-22 Thread Ashutosh Bapat
On Wed, Jun 21, 2017 at 7:48 PM, Simon Riggs wrote: > On 21 June 2017 at 16:15, Yugo Nagata wrote: >> On Wed, 21 Jun 2017 19:08:35 +0530 >> Kuntal Ghosh wrote: >> >>> On Wed, Jun 21, 2017 at 6:05 PM, Yugo Nagata

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Kang Yuzhe
On Thu, Jun 22, 2017 at 11:23 AM, Craig Ringer wrote: > On 22 June 2017 at 16:05, Kang Yuzhe wrote: >> Dear PG hackers, >> >> First my apology if I appear to be a jerk or not following the policy. >> >> I emailed Boxuan Zhai who was in charge of the

Re: [HACKERS] Setting pd_lower in GIN metapage

2017-06-22 Thread Amit Langote
On 2017/06/22 16:56, Michael Paquier wrote: > On Wed, Jun 21, 2017 at 9:42 AM, Amit Langote > wrote: >> On 2017/06/20 20:37, Amit Kapila wrote: >>> On Tue, Jun 20, 2017 at 1:50 PM, Amit Langote >>> wrote: On 2017/06/19 23:31, Tom

Re: [HACKERS] Regarding Postgres Dynamic Shared Memory (DSA)

2017-06-22 Thread Mahendranath Gurram
Hi Thomas, I'm implementing the In-Memory index as per your suggestion. So far it's good. As of now, only one thing is unclear for me. How could i detach the dsa(dsa_detach() call) in backend (typically during backend quit). Of-course when process quits, all it's associated memory will

Re: [HACKERS] PATCH: Batch/pipelining support for libpq

2017-06-22 Thread Daniel Verite
Craig Ringer wrote: > The kernel will usually do some packet aggregation unless we use > TCP_NODELAY (which we don't and shouldn't) Not sure. As a point of comparison, Oracle has it as a tunable parameter (TCP.NODELAY), and they changed its default from No to Yes starting from their 10g

Re: [HACKERS] A bug in mapping attributes in ATExecAttachPartition()

2017-06-22 Thread Ashutosh Bapat
On Thu, Jun 15, 2017 at 4:06 PM, Amit Langote wrote: > > Anyway, I tried to implement the refactoring in patch 0002, which is not > all of the patch 0001 that Jeevan posted. Please take a look. I wondered > if we should emit a NOTICE when an individual leaf

Re: [HACKERS] An attempt to reduce WALWriteLock contention

2017-06-22 Thread Sokolov Yura
On 2017-06-22 04:16, Michael Paquier wrote: On Wed, Jun 21, 2017 at 4:57 PM, jasrajd wrote: We are also seeing contention on the walwritelock and repeated writes to the same offset if we move the flush outside the lock in the Azure environment. pgbench doesn't scale

Re: [HACKERS] Incorrect documentation about pg_stat_activity

2017-06-22 Thread Yugo Nagata
On Thu, 22 Jun 2017 14:14:53 +0530 Ashutosh Bapat wrote: > On Wed, Jun 21, 2017 at 7:48 PM, Simon Riggs wrote: > > On 21 June 2017 at 16:15, Yugo Nagata wrote: > >> On Wed, 21 Jun 2017 19:08:35 +0530 > >> Kuntal Ghosh

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Craig Ringer
On 22 June 2017 at 17:00, Kang Yuzhe wrote: > diff --git a/src/backend/executor/nodeModifyTable.c > b/src/backend/executor/nodeModifyTable.c > index 8619ce3..e3ac758 100644 > --- a/src/backend/executor/nodeModifyTable.c > +++ b/src/backend/executor/nodeModifyTable.c The

[HACKERS] TRUE and true

2017-06-22 Thread Kyotaro HORIGUCHI
Hello, I have a maybe-silly question. What makes us have both TRUE/true or FALSE/false as constants of bool? The following definitions in c.h didn't mess anything up. #define TRUEtrue #define FALSE false # NIL seems causing similar mess. regards, -- Kyotaro Horiguchi NTT Open Source

Re: [HACKERS] Regarding Postgres Dynamic Shared Memory (DSA)

2017-06-22 Thread Thomas Munro
On Thu, Jun 22, 2017 at 10:59 PM, Mahendranath Gurram wrote: > I'm implementing the In-Memory index as per your suggestion. So far it's > good. Great news. > As of now, only one thing is unclear for me. How could i detach the > dsa(dsa_detach() call) in backend

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Michael Paquier
On Thu, Jun 22, 2017 at 5:30 PM, Kang Yuzhe wrote: > I wish I could but it's because I don't believe that I have the right > capability to fix code conflicts. My ultimate goal is to be PG hacker > like YOU. Anyway, I will consider your perspective. Nice to see such a goal,

Re: [HACKERS] PATCH: Batch/pipelining support for libpq

2017-06-22 Thread Daniel Verite
Andres Freund wrote: - if (pqFlush(conn) < 0) - goto sendFailed; + if (conn->batch_status == PQBATCH_MODE_OFF) + { + /* +* Give the data a push. In nonblock mode, don't complain if we're unable +* to send it

Re: [HACKERS] TRUE and true

2017-06-22 Thread Alexander Korotkov
On Thu, Jun 22, 2017 at 2:09 PM, Kyotaro HORIGUCHI < horiguchi.kyot...@lab.ntt.co.jp> wrote: > Hello, I have a maybe-silly question. > > What makes us have both TRUE/true or FALSE/false as constants of > bool? > > The following definitions in c.h didn't mess anything up. > > #define TRUEtrue

Re: [HACKERS] Pluggable storage

2017-06-22 Thread Alexander Korotkov
On Tue, Jun 13, 2017 at 4:50 AM, Haribabu Kommi wrote: > On Fri, Oct 14, 2016 at 7:26 AM, Alvaro Herrera > wrote: > >> I have sent the partial patch I have to Hari Babu Kommi. We expect that >> he will be able to further this goal some more.

Re: [HACKERS] Pluggable storage

2017-06-22 Thread Alexander Korotkov
On Thu, Jun 22, 2017 at 4:01 AM, Michael Paquier wrote: > Putting that in a couple of words. > 1. Table AM with a 6-byte TID. > 2. Table AM with a custom locator format, which could be TID-like. > 3. Table AM with no locators. > > Getting into having #1 first to work

[HACKERS] [patch] pg_dump/pg_restore zerror() and strerror() mishap

2017-06-22 Thread Kunshchikov Vladimir
Hello, our testing team has noticed apparently wrong backup/restore error messages like this: pg_restore: [compress_io] could not read from input file: success pg_dump: [directory archiver] could not write to output file: success Such "success" messages are caused by calling strerror()

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Peter Eisentraut
On 6/22/17 05:13, Craig Ringer wrote: > On 22 June 2017 at 17:00, Kang Yuzhe wrote: > >> diff --git a/src/backend/executor/nodeModifyTable.c >> b/src/backend/executor/nodeModifyTable.c >> index 8619ce3..e3ac758 100644 >> --- a/src/backend/executor/nodeModifyTable.c >> +++

[HACKERS] Multi column range partition table

2017-06-22 Thread amul sul
Hi, While working on the another patch, I came across the case where I need an auto generated partition for a mutil-column range partitioned table having following range bound: PARTITION p1 FROM (UNBOUNDED, UNBOUNDED) TO (10, 10) PARTITION p2 FROM (10, 10) TO (10, UNBOUNDED) PARTITION p3 FROM

Re: [HACKERS] TRUE and true

2017-06-22 Thread Peter Eisentraut
On 6/22/17 07:09, Kyotaro HORIGUCHI wrote: > What makes us have both TRUE/true or FALSE/false as constants of > bool? Historical reasons, probably. I plan to submit a patch to phase out or remove TRUE/FALSE as part of a migration toward stdbool.h. So I suggest you use lower case and don't worry

Re: [HACKERS] Prologue of set_append_rel_size() and partitioned tables

2017-06-22 Thread Robert Haas
On Wed, Mar 29, 2017 at 3:18 AM, Ashutosh Bapat wrote: >> Update patch attached. > > Looks good to me. Committed. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list

Re: [HACKERS] Redundant check of em_is_child

2017-06-22 Thread Robert Haas
On Fri, May 19, 2017 at 3:46 AM, Amit Langote wrote: > In match_eclasses_to_foreign_key_col(), there is this: > > if (em->em_is_child) > continue; /* ignore children here */ > > ISTM, it might as well be: > >

Re: [HACKERS] Multiple TO version in ALTER EXTENSION UPDATE

2017-06-22 Thread Tom Lane
Robert Haas writes: > On Wed, Mar 29, 2017 at 11:13 AM, Daniel Gustafsson wrote: >> While reading I noticed that we allow multiple TO in ALTER >> EXTENSION >> UPDATE, and defer throwing a syntax error until command processing. Is >> there a >> reason

Re: [HACKERS] [psql] patch to fix ordering in words_after_create array

2017-06-22 Thread Robert Haas
On Fri, Mar 24, 2017 at 7:10 AM, Rushabh Lathia wrote: > While looking at the code around tab-complete.c, I > found the ordering in words_after_create array is not > correct for DEFAULT PRIVILEGES, which been added > under below commit: > > commit

Re: [HACKERS] shift_sjis_2004 related autority files are remaining

2017-06-22 Thread Robert Haas
On Fri, Apr 7, 2017 at 1:59 AM, Kyotaro HORIGUCHI wrote: > Hi, I happned to notice that backend/utils/mb/Unicode directory > contains two encoding authority files, which I believe are not to > be there. > > euc-jis-2004-std.txt > sjis-0213-2004-std.txt > > And

Re: [HACKERS] Misplacement of function declaration in contrib/postgres_fdw/postgres_fdw.h

2017-06-22 Thread Robert Haas
On Wed, Jan 11, 2017 at 10:19 PM, Etsuro Fujita wrote: > While working on pushing down more joins/updates to the remote, I noticed > that in contrib/postgres_fdw/postgres_fdw.h the declaration of > get_jointype_name is misplaced in the section of shippable.c. Since

Re: [HACKERS] possible self-deadlock window after bad ProcessStartupPacket

2017-06-22 Thread Robert Haas
On Thu, Feb 2, 2017 at 3:18 PM, Jimmy Yih wrote: > In that pull request, we fix the issue by checking for proc_exit_inprogress. > Is there a reason why startup_die should not check for proc_exit_inprogress? startup_die() is just calling proc_exit(), so it seems like it might be

Re: [HACKERS] possible self-deadlock window after bad ProcessStartupPacket

2017-06-22 Thread Andres Freund
On 2017-06-22 10:41:41 -0700, Andres Freund wrote: > On 2017-02-02 12:18:22 -0800, Jimmy Yih wrote: > > In the above pull request, Heikki also mentions that a similar scenario can > > happen during palloc() as well... which is similar to what we saw in > > Greenplum a couple years back for a

Re: [HACKERS] pg_stop_backup(wait_for_archive := true) on standby server

2017-06-22 Thread Masahiko Sawada
On Thu, Jun 22, 2017 at 10:36 PM, Magnus Hagander wrote: > > > On Thu, Jun 22, 2017 at 10:12 AM, Masahiko Sawada > wrote: >> >> Hi, >> >> Since an optional second argument wait_for_archive of pg_stop_backup >> has been introduced in PostgreSQL 10 we

Re: [HACKERS] lseek/read/write overhead becomes visible at scale ..

2017-06-22 Thread Robert Haas
On Wed, Jan 25, 2017 at 2:52 PM, Andres Freund wrote: > You'll, depending on your workload, still have a lot of lseeks even if > we were to use pread/pwrite because we do lseek(SEEK_END) to get file > sizes. I'm pretty convinced that the lseek overhead that we're incurring

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Kang Yuzhe
On Thu, Jun 22, 2017 at 7:52 PM, Jan de Visser wrote: > On Thursday, June 22, 2017 12:32:14 PM EDT Kang Yuzhe wrote: >> Here is a sample what I did after applying the patch. >> >> testdb=# BEGIN; >> BEGIN >> testdb=# >> testdb=# MERGE INTO Stock USING Buy ON Stock.item_id =

Re: [HACKERS] Fast promotion not used when doing a recovery_target PITR restore?

2017-06-22 Thread Andres Freund
On 2017-06-22 14:04:42 +0900, Michael Paquier wrote: > On Thu, Jun 22, 2017 at 3:04 AM, Andres Freund wrote: > > When doing a PITR style recovery, with recovery target set, we're > > currently not doing a fast promotion, in contrast to the handling when > > doing a pg_ctl or

Re: [HACKERS] Stale comments in vacuumlazy.c

2017-06-22 Thread Robert Haas
On Sun, Mar 26, 2017 at 3:22 PM, Pavan Deolasee wrote: > I happened to notice a stale comment at the very beginning of vacuumlazy.c. > ISTM we forgot to fix that when we introduced FSM. With FSM, vacuum no > longer needed to track per-page free space info. I propose

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Kang Yuzhe
On Thu, Jun 22, 2017 at 3:51 PM, Peter Eisentraut wrote: > On 6/22/17 05:13, Craig Ringer wrote: >> On 22 June 2017 at 17:00, Kang Yuzhe wrote: >> >>> diff --git a/src/backend/executor/nodeModifyTable.c >>>

Re: [HACKERS] Re-indent HEAD tomorrow?

2017-06-22 Thread Bruce Momjian
On Thu, Jun 22, 2017 at 10:38:41AM -0400, Robert Haas wrote: > On Wed, Jun 21, 2017 at 5:28 PM, Tom Lane wrote: > > Right now we're really just speculating about how much pain there will > > be, on either end of this. So it'd be interesting for somebody who's > > carrying

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Kang Yuzhe
On Thu, Jun 22, 2017 at 12:10 PM, Thomas Munro wrote: > On Thu, Jun 22, 2017 at 9:00 PM, Kang Yuzhe wrote: >> I just downloaded the patch from GSoC site. > > I just looked at > https://wiki.postgresql.org/wiki/Add_MERGE_command_GSoC_2010 and

Re: [HACKERS] lseek/read/write overhead becomes visible at scale ..

2017-06-22 Thread Andres Freund
On 2017-06-22 12:43:16 -0400, Robert Haas wrote: > On Wed, Jan 25, 2017 at 2:52 PM, Andres Freund wrote: > > You'll, depending on your workload, still have a lot of lseeks even if > > we were to use pread/pwrite because we do lseek(SEEK_END) to get file > > sizes. > > I'm

Re: [HACKERS] possible self-deadlock window after bad ProcessStartupPacket

2017-06-22 Thread Andres Freund
On 2017-02-02 12:18:22 -0800, Jimmy Yih wrote: > In the above pull request, Heikki also mentions that a similar scenario can > happen during palloc() as well... which is similar to what we saw in > Greenplum a couple years back for a deadlock in a malloc() call where we > responded by changing

Re: [HACKERS] GSoC 2017 Proposal for predicate locking in hash index

2017-06-22 Thread Shubham Barai
Hi, On 22 June 2017 at 21:12, Alvaro Herrera wrote: > Shubham Barai wrote: > > Hi, > > > > Now that hash index support write-ahead logging, it will be great if we > add > > support for predicate locking to it. > > Implementation of predicate locking in hash index seems

Re: [HACKERS] Autovacuum launcher occurs error when cancelled by SIGINT

2017-06-22 Thread Alvaro Herrera
Thomas Munro wrote: > Hmm. So the problem here is that AutoVacLauncherMain assumes that > there are only two possibilities: (1) there is no handle published in > shmem yet, so we should create a DSA area and publish the handle, and > (2) there is a handle published in shmem so we should attach

Re: [HACKERS] Missing comment for create_modifytable_path

2017-06-22 Thread Robert Haas
On Thu, Jun 15, 2017 at 4:40 AM, Etsuro Fujita wrote: > While working on adding support for tuple routing for foreign partitions, I > noticed that in create_modifytable_path, we forgot to add a comment on its > new argument 'partitioned_rels'. Attached a patch for

Re: [HACKERS] Autovacuum launcher occurs error when cancelled by SIGINT

2017-06-22 Thread Alvaro Herrera
Yugo Nagata wrote: > Hi, > > As I report in another thread[1], I found the autovacuum launcher occurs > the following error in PG 10 when this received SIGINT. I can repuroduce > this by pg_cancel_backend or `kill -2 `. Thanks for the report, BTW! -- Álvaro Herrera

Re: [HACKERS] PATCH: Batch/pipelining support for libpq

2017-06-22 Thread Daniel Verite
Andres Freund wrote: > > One option may be to leave that decision to the user by providing a > > PQBatchAutoFlush(true|false) property, along with a PQBatchFlush() > > function. > > What'd be the difference between PQflush() and PQbatchFlush()? I guess no difference, I was just not

[HACKERS] Guarding against bugs-of-omission in initdb's setup_depend

2017-06-22 Thread Tom Lane
While thinking about something else, it started to bother me that initdb's setup_depend() function knows exactly which catalogs might contain pinnable objects. It is not very hard to imagine that somebody might add a DATA() line to, say, pg_transform.h and expect that the represented object could

Re: [HACKERS] possible self-deadlock window after bad ProcessStartupPacket

2017-06-22 Thread Tom Lane
Andres Freund writes: > Or, probably more robust: Simply _exit(2) without further ado, and rely > on postmaster to output an appropriate error message. Arguably it's not > actually useful to see hundreds of "WARNING: terminating connection because of > crash of another server

Re: [HACKERS] Autovacuum launcher occurs error when cancelled by SIGINT

2017-06-22 Thread Thomas Munro
On Thu, Jun 22, 2017 at 4:29 AM, Kuntal Ghosh wrote: > On Wed, Jun 21, 2017 at 7:52 PM, Dilip Kumar wrote: >> On Wed, Jun 21, 2017 at 7:47 PM, Kuntal Ghosh >> wrote: IMHO, It's not a good idea to use DSM call to

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Jan de Visser
On Thursday, June 22, 2017 12:32:14 PM EDT Kang Yuzhe wrote: > Here is a sample what I did after applying the patch. > > testdb=# BEGIN; > BEGIN > testdb=# > testdb=# MERGE INTO Stock USING Buy ON Stock.item_id = Buy.item_id > testdb-# WHEN MATCHED THEN UPDATE SET balance = balance + Buy.volume

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Peter Geoghegan
On Thu, Jun 22, 2017 at 9:52 AM, Jan de Visser wrote: > I am not quite sure what you're trying to achieve, but are you aware that > pgsql 9.6 introduced the ON CONFLICT clause, which allows you to do the same > with a different syntax? > >

Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions

2017-06-22 Thread Kang Yuzhe
On Thu, Jun 22, 2017 at 3:13 PM, Michael Paquier wrote: > On Thu, Jun 22, 2017 at 5:30 PM, Kang Yuzhe wrote: >> I wish I could but it's because I don't believe that I have the right >> capability to fix code conflicts. My ultimate goal is to be PG

Re: [HACKERS] Fix comment in xlog.c

2017-06-22 Thread Alvaro Herrera
Amit Langote wrote: > Attached a patch for $SUBJECT. > > - * If RecPtr is not NULL, try to read a record at that position. Otherwise > + * If RecPtr is valid, try to read a record at that position. Otherwise > > Commit 4d6d425ab8d addressed the comment above XLogReadRecord() in > xlogreader.c,

[HACKERS] Dynamic instrumentation of lwlock wait times (lwlock flamegraphs)

2017-06-22 Thread Andres Freund
Hi, At pgcon some people were talking about the difficulty of instrumenting the time actually spent waiting for lwlocks and related measurements. I'd mentioned that linux these days provides infrastructure to measure such things in unmodified binaries. Attached is a prototype of a script that

Re: [HACKERS] Fix a typo in README.dependencies

2017-06-22 Thread Alvaro Herrera
Ashutosh Bapat wrote: > On Mon, Jun 5, 2017 at 8:22 AM, atorikoshi > wrote: > > Hi, > > > > I found below formula to compute selectivities, but > > I think the last Probability 'P(b=?)' should be 'P(c=?)'. > > > >> P(a=?,b=?,c=?) = P(a=?,b=?) * (d +

Re: [HACKERS] Adding support for Default partition in partitioning

2017-06-22 Thread Robert Haas
On Wed, Jun 21, 2017 at 8:47 PM, Amit Langote wrote: > It's the comma inside the error message that suggests to me that it's a > style that I haven't seen elsewhere in the backend code. Exactly. Avoid that. -- Robert Haas EnterpriseDB:

Re: [HACKERS] Guarding against bugs-of-omission in initdb's setup_depend

2017-06-22 Thread Robert Haas
On Thu, Jun 22, 2017 at 2:11 PM, Tom Lane wrote: > While thinking about something else, it started to bother me that > initdb's setup_depend() function knows exactly which catalogs might > contain pinnable objects. It is not very hard to imagine that somebody > might add a

Re: [HACKERS] Pluggable storage

2017-06-22 Thread Tomas Vondra
Hi, On 6/21/17 9:47 PM, Robert Haas wrote: ... > like int8 or numeric, it won't work at all. Even for other things, it's going to cause problems because the bit patterns won't be what the code is expecting; e.g. bitmap scans care about the structure of the TID, not just how many bits it is.

Re: [HACKERS] Pluggable storage

2017-06-22 Thread Tomas Vondra
Hi, On 6/22/17 4:36 PM, Alexander Korotkov wrote: On Thu, Jun 22, 2017 at 5:27 PM, Robert Haas > wrote: On Thu, Jun 22, 2017 at 8:32 AM, Alexander Korotkov > wrote: >

Re: [HACKERS] Autovacuum launcher occurs error when cancelled by SIGINT

2017-06-22 Thread Alvaro Herrera
Thomas Munro wrote: > I thought about this when designing the DSA API. I couldn't think of > any good reason to provide an 'am-I-already-attached?' function > equivalent to dsm_find_mapping. It seemed to me that the client code > shouldn't ever be in any doubt about whether it's attached, and

Re: [HACKERS] Proposal : For Auto-Prewarm.

2017-06-22 Thread Robert Haas
On Thu, Jun 15, 2017 at 12:35 AM, Mithun Cy wrote: > [ new patch ] I think this is looking better. I have some suggestions: * I suggest renaming launch_autoprewarm_dump() to autoprewarm_start_worker(). I think that will be clearer. Remember that user-visible

[HACKERS] Can ICU be used for a database's default sort order?

2017-06-22 Thread Tom Lane
I tried to arrange $subject via create database icu encoding 'utf8' lc_ctype "en-US-x-icu" lc_collate "en-US-x-icu" template template0; and got only ERROR: invalid locale name: "en-US-x-icu" which is unsurprising after looking into the code, because createdb() checks those parameters with

Re: [HACKERS] intermittent failures in Cygwin from select_parallel tests

2017-06-22 Thread Amit Kapila
On Thu, Jun 22, 2017 at 7:54 PM, Tom Lane wrote: > Andrew Dunstan writes: >> Please let me know if there are tests I can run. I missed your earlier >> request in this thread, sorry about that. > > That earlier request is still valid. > Yeah,

Re: [HACKERS] psql: Activate pager only for height, not width

2017-06-22 Thread Brendan Jurd
On Tue, 30 May 2017 at 05:30 Christoph Berg wrote: > Oh interesting, I didn't know about pager_min_lines. That sounds > useful as well. +1 on the analogous pager_min_cols option. > On closer inspection, I note that psql already has a 'columns' \pset option, which does control

Re: [HACKERS] TRUE and true

2017-06-22 Thread Kyotaro HORIGUCHI
At Thu, 22 Jun 2017 09:13:56 -0400, Peter Eisentraut wrote in <08678a07-3967-8567-59e5-b9bcced7f...@2ndquadrant.com> > On 6/22/17 07:09, Kyotaro HORIGUCHI wrote: > > What makes us have both TRUE/true or FALSE/false as constants of > > bool? > > Historical

Re: [HACKERS] intermittent failures in Cygwin from select_parallel tests

2017-06-22 Thread Tom Lane
Andrew Dunstan writes: > On 06/22/2017 10:24 AM, Tom Lane wrote: >> That earlier request is still valid. Also, if you can reproduce the >> symptom that lorikeet just showed and get a stack trace from the >> (hypothetical) postmaster core dump, that would be hugely

Re: [HACKERS] Regarding Postgres Dynamic Shared Memory (DSA)

2017-06-22 Thread Mahendranath Gurram
Hi Thomas, When you create or attach to a DSA area, a detach callback is automatically registered on the control segment (or containing segment, for an in-place DSA area). See the code like this in dsa.c: /* Clean up when the control segment detaches. */ on_dsm_detach(segment,

Re: [HACKERS] Multi column range partition table

2017-06-22 Thread amul sul
On Fri, Jun 23, 2017 at 6:58 AM, Amit Langote wrote: > On 2017/06/22 20:48, amul sul wrote: >> Hi, >> >> While working on the another patch, I came across the case where >> I need an auto generated partition for a mutil-column range partitioned >> table having

[HACKERS] Small bug in replication lag tracking

2017-06-22 Thread Thomas Munro
Hi, I discovered a thinko in the new replication lag interpolation code that can cause a strange number to be reported occasionally. The interpolation code is designed to report increasing lag when replay gets stuck somewhere between two LSNs for which we have timestamp samples. The bug is that

Re: [HACKERS] Fix a typo in partition.c

2017-06-22 Thread Masahiko Sawada
On Thu, Jun 22, 2017 at 10:38 PM, Magnus Hagander wrote: > > > On Thu, Jun 22, 2017 at 4:16 AM, Masahiko Sawada > wrote: >> >> On Wed, Jun 21, 2017 at 3:32 AM, Peter Eisentraut >> wrote: >> > On 6/19/17 23:02,

Re: [HACKERS] shift_sjis_2004 related autority files are remaining

2017-06-22 Thread Kyotaro HORIGUCHI
At Fri, 23 Jun 2017 10:04:26 +0900 (JST), Tatsuo Ishii wrote in <20170623.100426.157023025943107410.t-is...@sraoss.co.jp> > > Hm. I am wondering about licensing issues here to keep those files in > > the tree. I am no lawyer. > > Of course. Regarding euc-jis-2004-std.txt and

Re: [HACKERS] Can ICU be used for a database's default sort order?

2017-06-22 Thread Peter Geoghegan
On Thu, Jun 22, 2017 at 7:10 PM, Tom Lane wrote: > Is there some way I'm missing, or is this just a not-done-yet feature? It's a not-done-yet feature. -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: [HACKERS] Missing comment for create_modifytable_path

2017-06-22 Thread Etsuro Fujita
On 2017/06/23 2:53, Robert Haas wrote: On Thu, Jun 15, 2017 at 4:40 AM, Etsuro Fujita wrote: While working on adding support for tuple routing for foreign partitions, I noticed that in create_modifytable_path, we forgot to add a comment on its new argument

Re: [HACKERS] Guarding against bugs-of-omission in initdb's setup_depend

2017-06-22 Thread Tom Lane
Robert Haas writes: > On Thu, Jun 22, 2017 at 2:11 PM, Tom Lane wrote: >> So I'm thinking about adding a regression test case, say in dependency.sql, >> that looks for unpinned objects with OIDs in the hand-assigned range, >> along the lines of this

Re: [HACKERS] Setting pd_lower in GIN metapage

2017-06-22 Thread Masahiko Sawada
On Fri, Jun 23, 2017 at 11:17 AM, Amit Langote wrote: > On 2017/06/23 10:22, Masahiko Sawada wrote: >> On Thu, Jun 22, 2017 at 6:55 PM, Amit Langote >> wrote: >>> On 2017/06/22 16:56, Michael Paquier wrote: Did you check this

Re: [HACKERS] Setting pd_lower in GIN metapage

2017-06-22 Thread Amit Langote
On 2017/06/23 10:22, Masahiko Sawada wrote: > On Thu, Jun 22, 2017 at 6:55 PM, Amit Langote > wrote: >> On 2017/06/22 16:56, Michael Paquier wrote: >>> Did you check this patch with wal_consistency_checking? I am getting >>> failures so your patch does not have the

Re: [HACKERS] Broken hint bits (freeze)

2017-06-22 Thread Amit Kapila
On Wed, Jun 21, 2017 at 10:03 PM, Bruce Momjian wrote: > On Wed, Jun 21, 2017 at 07:49:21PM +0530, Amit Kapila wrote: >> On Tue, Jun 20, 2017 at 7:24 PM, Amit Kapila wrote: >> > Hmm. I think we need something that works with lesser effort because >> >

Re: [HACKERS] intermittent failures in Cygwin from select_parallel tests

2017-06-22 Thread Andrew Dunstan
On 06/22/2017 10:24 AM, Tom Lane wrote: > Andrew Dunstan writes: >> Please let me know if there are tests I can run. I missed your earlier >> request in this thread, sorry about that. > That earlier request is still valid. Also, if you can reproduce the >

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2017-06-22 Thread Chapman Flack
On 06/21/17 04:51, Heikki Linnakangas wrote: > (I'm cleaning up my inbox, hence the delayed reply) I had almost completely forgotten ever bringing it up. :) > When I wrote that code, I don't remember if I realized that we're > initializing the page headers, or if I thought that it's good enough

Re: [HACKERS] [POC] hash partitioning

2017-06-22 Thread Yugo Nagata
On Tue, 6 Jun 2017 13:03:58 +0530 amul sul wrote: > Updated patch attached. I looked into the latest patch (v13) and have some comments althogh they might be trivial. First, I couldn't apply this patch to the latest HEAD due to a documentation fix and pgintend updates. It

Re: [HACKERS] Getting server crash on Windows when using ICU collation

2017-06-22 Thread Ashutosh Sharma
Hi, On Wed, Jun 21, 2017 at 9:50 AM, Amit Kapila wrote: > On Wed, Jun 21, 2017 at 12:15 AM, Peter Eisentraut > wrote: >> On 6/20/17 09:23, Amit Kapila wrote: >>> To avoid that why can't we use the same icu path for executing uconv >>>

Re: [HACKERS] TRUE and true

2017-06-22 Thread Kyotaro HORIGUCHI
At Thu, 22 Jun 2017 15:35:13 +0300, Alexander Korotkov wrote in

Re: [HACKERS] Autovacuum launcher occurs error when cancelled by SIGINT

2017-06-22 Thread Yugo Nagata
On Thu, 22 Jun 2017 13:55:26 -0400 Alvaro Herrera wrote: > Yugo Nagata wrote: > > Hi, > > > > As I report in another thread[1], I found the autovacuum launcher occurs > > the following error in PG 10 when this received SIGINT. I can repuroduce > > this by

Re: [HACKERS] [POC] hash partitioning

2017-06-22 Thread Yugo Nagata
On Fri, 23 Jun 2017 13:41:15 +0900 Yugo Nagata wrote: > On Tue, 6 Jun 2017 13:03:58 +0530 > amul sul wrote: > > > > Updated patch attached. > > I looked into the latest patch (v13) and have some comments > althogh they might be trivial. One more

Re: [HACKERS] Fix comment in xlog.c

2017-06-22 Thread Amit Langote
On 2017/06/23 5:44, Alvaro Herrera wrote: > Amit Langote wrote: >> Attached a patch for $SUBJECT. >> >> - * If RecPtr is not NULL, try to read a record at that position. Otherwise >> + * If RecPtr is valid, try to read a record at that position. Otherwise >> >> Commit 4d6d425ab8d addressed the

Re: [HACKERS] Setting pd_lower in GIN metapage

2017-06-22 Thread Masahiko Sawada
On Thu, Jun 22, 2017 at 6:55 PM, Amit Langote wrote: > On 2017/06/22 16:56, Michael Paquier wrote: >> On Wed, Jun 21, 2017 at 9:42 AM, Amit Langote >> wrote: >>> On 2017/06/20 20:37, Amit Kapila wrote: On Tue, Jun 20, 2017 at

Re: [HACKERS] shift_sjis_2004 related autority files are remaining

2017-06-22 Thread Michael Paquier
On Fri, Jun 23, 2017 at 9:39 AM, Tatsuo Ishii wrote: > I think we should keep the original .txt files because: Hm. I am wondering about licensing issues here to keep those files in the tree. I am no lawyer. > - It allows to track the changes in the original file if we decide

Re: [HACKERS] shift_sjis_2004 related autority files are remaining

2017-06-22 Thread Tatsuo Ishii
> Hm. I am wondering about licensing issues here to keep those files in > the tree. I am no lawyer. Of course. Regarding euc-jis-2004-std.txt and sjis-0213-2004-std.txt, it seems safe to keep them. > ## Date: 13 May 2006 > ## License: > ##Copyright (C) 2001 earth...@tama.or.jp, All Rights

[HACKERS] ICU non-utf8 code path leaks memory like there's no tomorrow

2017-06-22 Thread Tom Lane
In a database with utf8 encoding, this behaves reasonably: select count(*) from (select * from generate_series(1,1000) x order by x::text collate "en-x-icu") ss; It eats circa 25MB, not a lot worse than the libc-collation equivalent. But try it in say LATIN1, and it eats multiple gigabytes.

  1   2   >