[bug fix] Produce a crash dump before main() on Windows

2018-02-15 Thread Tsunakawa, Takayuki
Hello, postgres.exe on Windows doesn't output a crash dump when it crashes before main() is called. The attached patch fixes this. I'd like this to be back-patched. I'll add this to the next CF. The original problem happened on our customer's production system. Their application sometimes

Re: [bug fix] Cascaded standby cannot start after a clean shutdown

2018-02-15 Thread Michael Paquier
On Wed, Feb 14, 2018 at 04:37:05AM +, Tsunakawa, Takayuki wrote: > The PostgreSQL version is 9.5. The cluster consists of a master, a > cascading standby (SB1), and a cascaded standby (SB2). The WAL flows > like this: master -> SB1 -> SB2. > > The user shut down SB2 and tried to restart

Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()

2018-02-15 Thread Michael Paquier
On Mon, Feb 12, 2018 at 04:33:51PM +0530, Pavan Deolasee wrote: > I'm not sure if Michael has spotted a real problem or was that just a > concern. He himself later rightly pointed out that when a WAL file is > switched, the old file is filled with zeros. So I don't see a problem > there. May be I

Re: Removing useless #include's.

2018-02-15 Thread Tom Lane
Kyotaro HORIGUCHI writes: > At Thu, 15 Feb 2018 11:12:05 -0500, Tom Lane wrote in > <6748.1518711...@sss.pgh.pa.us> >> Kyotaro HORIGUCHI writes: >>> I found 641 includes that is just removable with no side

Re: reorganizing partitioning code

2018-02-15 Thread Kyotaro HORIGUCHI
Hello. I'd like to make a humble comment. At Thu, 15 Feb 2018 19:31:47 +0900, Amit Langote wrote in <8906c861-ea47-caee-c860-eff8d7e1d...@lab.ntt.co.jp> > Added to CF here: https://commitfest.postgresql.org/17/1520/ The reorganization adds/removes header files

Re: Let's remove DSM_INPL_NONE.

2018-02-15 Thread Kyotaro HORIGUCHI
Hello, thank you for the comment. At Fri, 16 Feb 2018 13:07:08 +0900, Michael Paquier wrote in <20180216040708.ga1...@paquier.xyz> > On Thu, Feb 15, 2018 at 07:58:57PM +0900, Kyotaro HORIGUCHI wrote: > > It is amost a just-to-delete work but I see two issues raised so > >

Re: spin.c includes pg_sema.h even if unnecessary

2018-02-15 Thread Kyotaro HORIGUCHI
At Thu, 15 Feb 2018 10:01:57 -0800, Andres Freund wrote in <20180215180157.7q55aytrhif7v...@alap3.anarazel.de> > On 2018-02-15 20:11:07 +0900, Kyotaro HORIGUCHI wrote: > > As in another mail just before, spin.c seems a bit strange > > (without acutual harm). > > > > spin.h

Re: non-bulk inserts and tuple routing

2018-02-15 Thread Amit Langote
On 2018/02/16 12:41, Etsuro Fujita wrote: > (2018/02/16 10:49), Amit Langote wrote: >> I think you're right.  If node->returningLists is non-NULL at all, >> ExecInitModifyTable() would've initialized the needed slot and expression >> context.  I added Assert()s to that affect. > > OK, but one

Re: Removing useless #include's.

2018-02-15 Thread Kyotaro HORIGUCHI
Hello. At Thu, 15 Feb 2018 11:12:05 -0500, Tom Lane wrote in <6748.1518711...@sss.pgh.pa.us> > Kyotaro HORIGUCHI writes: > > While looking some patch, just from curiosity, I checked for > > redundant #include's in the source tree (except > >

Re: Let's remove DSM_INPL_NONE.

2018-02-15 Thread Michael Paquier
On Thu, Feb 15, 2018 at 10:00:39AM -0800, Andres Freund wrote: > Hm, I'm not quite convinced by this. Seems to make testing a bunch of > codepaths harder. I think it's fine to say that pg doesn't work > correctly with them disabled though. Well, for what it's worth that's one thing less to be

Re: Let's remove DSM_INPL_NONE.

2018-02-15 Thread Michael Paquier
On Thu, Feb 15, 2018 at 07:58:57PM +0900, Kyotaro HORIGUCHI wrote: > It is amost a just-to-delete work but I see two issues raised so > far. The patch looks good as-is. This simplifies a couple of code paths deciding if parallel queries can be used or not, so future features in need of doing the

Re: [HACKERS] why not parallel seq scan for slow functions

2018-02-15 Thread Ashutosh Bapat
On Thu, Feb 15, 2018 at 7:47 PM, Amit Kapila wrote: > On Thu, Feb 15, 2018 at 4:18 PM, Ashutosh Bapat > wrote: >> I happened to look at the patch for something else. But here are some >> comments. If any of those have been already

Re: non-bulk inserts and tuple routing

2018-02-15 Thread Etsuro Fujita
(2018/02/16 10:49), Amit Langote wrote: On 2018/02/15 21:10, Etsuro Fujita wrote: here are some minor comments: o On changes to ExecCleanupTupleRouting: - ExecCloseIndices(resultRelInfo); - heap_close(resultRelInfo->ri_RelationDesc, NoLock); + if (resultRelInfo) + { +

Re: FOR EACH ROW triggers on partitioned tables

2018-02-15 Thread Amit Langote
On 2018/02/16 6:55, Alvaro Herrera wrote: > Amit Langote wrote: >> On 2018/02/15 6:26, Alvaro Herrera wrote: >>> Another option is to rethink this feature from the ground up: instead of >>> cloning catalog rows for each children, maybe we should have the trigger >>> lookup code, when running DML

Re: non-bulk inserts and tuple routing

2018-02-15 Thread Amit Langote
Fujita-san, Thanks for the review. On 2018/02/15 21:10, Etsuro Fujita wrote: > (2018/02/13 10:12), Amit Langote wrote: >> Updated patch is attached. > > Thanks, here are some minor comments: > > o On changes to ExecCleanupTupleRouting: > > -   ExecCloseIndices(resultRelInfo); > -  

Re: JIT compiling with LLVM v9.1

2018-02-15 Thread Andreas Karlsson
On 02/15/2018 06:23 PM, Andres Freund wrote: 2) When I build with --with-cassert I expect the assertions to be there, both in the binaries and the bitcode. Is that just a bug or is there any thought behind this? Not sure what you mean by that. NDEBUG and cassert are independent mechanisms, no?

Re: FOR EACH ROW triggers on partitioned tables

2018-02-15 Thread Alvaro Herrera
Amit Langote wrote: > On 2018/02/15 6:26, Alvaro Herrera wrote: > > Another option is to rethink this feature from the ground up: instead of > > cloning catalog rows for each children, maybe we should have the trigger > > lookup code, when running DML on the child relation (the partition), > >

Re: [HACKERS] [PATCH] Vacuum: Update FSM more frequently

2018-02-15 Thread Claudio Freire
On Thu, Feb 15, 2018 at 4:47 PM, Claudio Freire wrote: > On Wed, Feb 14, 2018 at 3:59 AM, Masahiko Sawada > wrote: >>> The final FSM vacuum pass isn't partial, to finally correct all those >>> small inconsistencies. >> >> Yes, but the purpose of

Re: [HACKERS] [PATCH] Vacuum: Update FSM more frequently

2018-02-15 Thread Claudio Freire
On Wed, Feb 14, 2018 at 3:59 AM, Masahiko Sawada wrote: > On Fri, Feb 9, 2018 at 11:48 PM, Claudio Freire > wrote: >> On Fri, Feb 9, 2018 at 1:36 AM, Masahiko Sawada >> wrote: >>> On Fri, Feb 9, 2018 at 12:45 AM, Claudio

Re: JIT compiling with LLVM v10.1

2018-02-15 Thread Andres Freund
Hi, On 2018-02-15 11:59:46 +0300, Konstantin Knizhnik wrote: > It is well known fact that Postgres spends most of the time in sequence scan > queries for warm data in deforming tuples (17% in case of TPC-H Q1). I think that the majority of the time therein is not actually bottlenecked by CPU,

Re: Add void cast to StaticAssertExpr?

2018-02-15 Thread Andres Freund
Hi, On 2018-02-15 12:19:46 -0500, Tom Lane wrote: > While poking around in buildfarm results, I noticed that some members are > giving warnings like > > analyze.c:386:181: warning: expression result unused [-Wunused-value] > > which is apparently caused by the use of StaticAssertExpr in > >

Re: spin.c includes pg_sema.h even if unnecessary

2018-02-15 Thread Andres Freund
On 2018-02-15 20:11:07 +0900, Kyotaro HORIGUCHI wrote: > As in another mail just before, spin.c seems a bit strange > (without acutual harm). > > spin.h doesn't include pg_sema.h when HAVE_SPINLOCKS is defined, > but spin.c always includes it even in the case. The file is > included only to use

Re: Let's remove DSM_INPL_NONE.

2018-02-15 Thread Andres Freund
Hi, On 2018-02-15 19:58:57 +0900, Kyotaro HORIGUCHI wrote: > As in the other threads[1][2], we have had several good reasons > to remove DSM_IMPL_NONE in PG11. The attached patch doesn that. > > [1] >

Re: JIT compiling with LLVM v9.1

2018-02-15 Thread Andres Freund
Hi, On 2018-02-15 12:54:34 +0100, Andreas Karlsson wrote: > 1) Why does config/llvm.m4 modify CPPFLAGS? That affects the building of the > binaries too which may be done with gcc like in my case. Shouldn't it use a > LLVM_CPPFLAGS or something? Well, most of the time cppflags just are things

Add void cast to StaticAssertExpr?

2018-02-15 Thread Tom Lane
While poking around in buildfarm results, I noticed that some members are giving warnings like analyze.c:386:181: warning: expression result unused [-Wunused-value] which is apparently caused by the use of StaticAssertExpr in #define AllocSetContextCreate(parent, name, allocparams) \

Re: [PATCH][PROPOSAL] Add enum releation option type

2018-02-15 Thread Nikolay Shaplov
В письме от 15 февраля 2018 12:53:27 пользователь Alvaro Herrera написал: > > > Maybe we need some in-core user to verify the string case still works. > > > A new module in src/test/modules perhaps? > > > > I've looked attentively in src/test/modules... To properly test all > > reloptions hooks

Re: Removing useless #include's.

2018-02-15 Thread Tom Lane
Kyotaro HORIGUCHI writes: > While looking some patch, just from curiosity, I checked for > redundant #include's in the source tree (except > contrib). "redundant" here means that a file is included in > another include file nearby. > I found 641 includes that is

Re: [PATCH][PROPOSAL] Add enum releation option type

2018-02-15 Thread Alvaro Herrera
Nikolay Shaplov wrote: > В письме от 9 февраля 2018 18:45:29 пользователь Alvaro Herrera написал: > > > Maybe we need some in-core user to verify the string case still works. > > A new module in src/test/modules perhaps? > I've looked attentively in src/test/modules... To properly test all >

Re: [PATCH][PROPOSAL] Add enum releation option type

2018-02-15 Thread Nikolay Shaplov
В письме от 9 февраля 2018 18:45:29 пользователь Alvaro Herrera написал: > Maybe we need some in-core user to verify the string case still works. > A new module in src/test/modules perhaps? I've looked attentively in src/test/modules... To properly test all reloptions hooks for modules wee need

Re: Cached/global query plans, autopreparation

2018-02-15 Thread Jorge Solórzano
On Thu, Feb 15, 2018 at 8:00 AM, Shay Rojansky wrote: > I am an author of one of the proposal (autoprepare which is in commit fest >> now), but I think that sooner or later Postgres has to come to solution >> with shared DB caches/prepared plans. >> Please correct me if I am

Re: [HACKERS] why not parallel seq scan for slow functions

2018-02-15 Thread Amit Kapila
On Thu, Feb 15, 2018 at 4:18 PM, Ashutosh Bapat wrote: > I happened to look at the patch for something else. But here are some > comments. If any of those have been already discussed, please feel > free to ignore. I have gone through the thread cursorily, so I

Re: Cached/global query plans, autopreparation

2018-02-15 Thread Shay Rojansky
> > I am an author of one of the proposal (autoprepare which is in commit fest > now), but I think that sooner or later Postgres has to come to solution > with shared DB caches/prepared plans. > Please correct me if I am wrong, but it seems to me that most of all other > top DBMSes having

Re: Cached/global query plans, autopreparation

2018-02-15 Thread Shay Rojansky
> > > Well, the issue is that implementing this is a major piece of work. This > > post doesn't offer either resources nor a simpler way to do so. There's > > no huge debate about the benefit of having a global plan cache, so I'm > > not that surprised there's not a huge debate about a post

Changing baserel to foreignrel in postgres_fdw functions

2018-02-15 Thread Ashutosh Bapat
Hi, I noticed that functions is_foreign_expr(), classifyConditions() and appendOrderByClause() had variables/arguments named baserel when the relations passed to those could be join or upper relation as well. Here's patch renaming those as foreignrel. -- Best Wishes, Ashutosh Bapat EnterpriseDB

Re: autovacuum: change priority of the vacuumed tables

2018-02-15 Thread Grigory Smolkin
On 02/15/2018 09:28 AM, Masahiko Sawada wrote: Hi, On Thu, Feb 8, 2018 at 11:01 PM, Ildus Kurbangaliev wrote: Hi, Attached patch adds 'autovacuum_table_priority' to the current list of automatic vacuuming settings. It's used in sorting of vacuumed tables in

spin.c includes pg_sema.h even if unnecessary

2018-02-15 Thread Kyotaro HORIGUCHI
Ouch! Sorry for the bogus subject of just-submitted mail. I'll make another thread with the fixed subject. Hello. As in another mail just before, spin.c seems a bit strange (without acutual harm). spin.h doesn't include pg_sema.h when HAVE_SPINLOCKS is defined, but spin.c always includes

Re: non-bulk inserts and tuple routing

2018-02-15 Thread Etsuro Fujita
(2018/02/13 10:12), Amit Langote wrote: On 2018/02/09 21:20, Etsuro Fujita wrote: * Please add a brief decsription about partition_oids to the comments for this struct. @@ -91,6 +91,7 @@ typedef struct PartitionTupleRouting { PartitionDispatch *partition_dispatch_info; int

Re: JIT compiling with LLVM v9.1

2018-02-15 Thread Andreas Karlsson
On 02/05/2018 10:44 PM, Pierre Ducroquet wrote: psqlscanslash.l: In function ‘psql_scan_slash_option’: psqlscanslash.l:550:8: warning: variable ‘lexresult’ set but not used [-Wunused-but-set-variable] int final_state; ^ I'm not sure Andres's patches have anything to do

Re: [HACKERS] MERGE SQL Statement for PG11

2018-02-15 Thread Pavan Deolasee
Hi Andreas, On Sun, Feb 4, 2018 at 5:45 PM, Andreas Seltenreich wrote: > > > Attached are testcases that trigger the assertions when run against an > empty database instead of the one left behind by make installcheck. The > "unrecognized node type" one appears to be a known

Removing useless #include's.

2018-02-15 Thread Kyotaro HORIGUCHI
Hello. While looking some patch, just from curiosity, I checked for redundant #include's in the source tree (except contrib). "redundant" here means that a file is included in another include file nearby. I found 641 includes that is just removable with no side effect with two exceptions. -

Re: HAVE_SPINLOCKS still requests exctra shared memory

2018-02-15 Thread Kyotaro HORIGUCHI
Please ignore this thread and see the following one instead. https://www.postgresql.org/message-id/20180215.201107.78574525.horiguchi.kyot...@lab.ntt.co.jp At Thu, 15 Feb 2018 20:07:03 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI wrote in

HAVE_SPINLOCKS still requests exctra shared memory

2018-02-15 Thread Kyotaro HORIGUCHI
Hello. As in another mail just before, spin.c seems a bit strange (without acutual harm). spin.h doesn't include pg_sema.h when HAVE_SPINLOCKS is defined, but spin.c always includes it even in the case. The file is included only to use sizeof(PGSemaphore) to calcualte SpinlockSemaSize as 0. The

Let's remove DSM_INPL_NONE.

2018-02-15 Thread Kyotaro HORIGUCHI
Hello. As in the other threads[1][2], we have had several good reasons to remove DSM_IMPL_NONE in PG11. The attached patch doesn that. [1] https://www.postgresql.org/message-id/CA+Tgmoa0e23YC3SCwB85Yf5oUTRyirV=sq_rxyxaxabldpp...@mail.gmail.com [2]

Re: [HACKERS] why not parallel seq scan for slow functions

2018-02-15 Thread Ashutosh Bapat
I happened to look at the patch for something else. But here are some comments. If any of those have been already discussed, please feel free to ignore. I have gone through the thread cursorily, so I might have missed something. In grouping_planner() we call query_planner() first which builds the

Re: reorganizing partitioning code

2018-02-15 Thread Amit Langote
Added to CF here: https://commitfest.postgresql.org/17/1520/ Thanks, Amit

Re: Transform for pl/perl

2018-02-15 Thread Anthony Bykov
On Wed, 31 Jan 2018 13:36:22 +0300 Arthur Zakirov wrote: > I've noticed a possible bug: > > > + /* json key in v */ > > + key = > > pstrdup(v.val.string.val); > > +

Re: [HACKERS] advanced partition matching algorithm for partition-wise join

2018-02-15 Thread Amit Langote
Hi Ashutosh. On 2018/02/09 14:27, Ashutosh Bapat wrote: > Here's updated patch set with those comments added. I looked at patches 0002 and 0003. In 0002: + * In case of hash partition we store modulus and remainder in datums array In case of hash partitioned table? + * which has the same

Re: JIT compiling with LLVM v10.1

2018-02-15 Thread Konstantin Knizhnik
On 14.02.2018 21:17, Andres Freund wrote: Hi, On 2018-02-07 06:54:05 -0800, Andres Freund wrote: I've pushed v10.0. The big (and pretty painful to make) change is that now all the LLVM specific code lives in src/backend/jit/llvm, which is built as a shared library which is loaded on demand.

Re: Cached/global query plans, autopreparation

2018-02-15 Thread Konstantin Knizhnik
On 13.02.2018 20:13, Shay Rojansky wrote: Hi all, Was wondering if anyone has a reaction to my email below about statement preparation, was it too long? :) (and sorry for top-posting) On Tue, Feb 6, 2018 at 9:27 PM, Shay Rojansky > wrote: Hi