Temporary WAL segments files not cleaned up after an instance crash

2018-05-13 Thread Michael Paquier
Hi all, While playing with a standby as follows I noticed that xlogtemp.* generated in pg_wal may stay around when entering crash recovery. The test I was conducting is pretty simple: - Use a primary and a standby. - Run pgbench on the primary. - Then restart the standby with -m immediate and

SPI/backend equivalent of extended-query Describe(statement)?

2018-05-13 Thread Chapman Flack
The longer version of $subject is: how would one go about, in the backend using SPI (or SPI and maybe other server APIs as needed), obtaining the same inferred parameter information that a front-end client can get with the Describe (statement variant) extended-query message? I ask because I've

Re: Incorrect comment in get_partition_dispatch_recurse

2018-05-13 Thread Amit Langote
Hi David. On 2018/05/14 13:57, David Rowley wrote: > I noticed that a comment in get_partition_dispatch_recurse claims that: > > "it contains the > * leaf partition's position in the global list *leaf_part_oids minus 1" > > The "minus 1" part is incorrect. It simply just stores the 0-based >

Re: Needless additional partition check in INSERT?

2018-05-13 Thread David Rowley
On 14 May 2018 at 16:49, Amit Langote wrote: > On 2018/05/11 18:43, Amit Khandekar wrote: >> This looks better (it will avoid unnecessary ExecConstraints() call) : >> >> if (resultRelInfo->ri_PartitionRoot == NULL || >> (resultRelInfo->ri_TrigDesc && >>

Re: Expression errors with "FOR UPDATE" and postgres_fdw with partition wise join enabled.

2018-05-13 Thread Ashutosh Bapat
On Fri, May 11, 2018 at 6:31 PM, Etsuro Fujita wrote: > > I guess you forgot to show the query. Sorry. Here's the query. explain verbose select * from fprt1 t1 join fprt2 t2 on t1.a = t2.b where t1 = row_as_is(row(t2.a, t2.b, t2.c)::ftprt2_p1)::fprt2; > > Yet yet

Re: Needless additional partition check in INSERT?

2018-05-13 Thread Amit Langote
On 2018/05/11 18:43, Amit Khandekar wrote: > This looks better (it will avoid unnecessary ExecConstraints() call) : > > if (resultRelInfo->ri_PartitionRoot == NULL || > (resultRelInfo->ri_TrigDesc && > resultRelInfo->ri_TrigDesc->trig_insert_before_row)) > check_partition_constr =

Re: Needless additional partition check in INSERT?

2018-05-13 Thread Amit Khandekar
On 14 May 2018 at 10:30, David Rowley wrote: > On 14 May 2018 at 16:49, Amit Langote wrote: >> On 2018/05/11 18:43, Amit Khandekar wrote: >>> This looks better (it will avoid unnecessary ExecConstraints() call) : >>> >>> if

Re: PANIC during crash recovery of a recently promoted standby

2018-05-13 Thread Michael Paquier
On Sat, May 12, 2018 at 07:41:33AM +0900, Michael Paquier wrote: > pg_ctl promote would wait for the control file to be updated, so you > cannot use it in the TAP tests to trigger the promotion. Still I think > I found one after waking up? Please note I have not tested it: > - Use a custom

Re: Compiler warnings with --enable-dtrace

2018-05-13 Thread Thomas Munro
On Sun, May 13, 2018 at 8:40 AM, Peter Geoghegan wrote: > On Fri, May 11, 2018 at 11:46 PM, Christoph Berg wrote: >> Re: Peter Geoghegan 2018-05-12 >>

Incorrect comment in get_partition_dispatch_recurse

2018-05-13 Thread David Rowley
I noticed that a comment in get_partition_dispatch_recurse claims that: "it contains the * leaf partition's position in the global list *leaf_part_oids minus 1" The "minus 1" part is incorrect. It simply just stores the 0-based index of the item in the list. I was going to fix it by removing

Re: Postgres 11 release notes

2018-05-13 Thread Amit Kapila
On Fri, May 11, 2018 at 8:38 PM, Bruce Momjian wrote: > I have committed the first draft of the Postgres 11 release notes. I > will add more markup soon. You can view the most current version here: > > http://momjian.us/pgsql_docs/release-11.html > > I expect a torrent

Re: Why does load_external_function() return PGFunction?

2018-05-13 Thread Robert Haas
On Thu, May 10, 2018 at 4:45 PM, Andres Freund wrote: > Possible. But IIRC the parameter-unknown form isn't valid C++ and Peter > Eisentraut has done a good chunk of work to make it possible to compile > postgres as that. We shouldn't make his job harder. Fair point. > IMO

Re: Postgres 11 release notes

2018-05-13 Thread Amit Langote
On Sat, May 12, 2018 at 12:08 AM, Bruce Momjian wrote: > I have committed the first draft of the Postgres 11 release notes. I > will add more markup soon. You can view the most current version here: > > http://momjian.us/pgsql_docs/release-11.html Thank you for

Re: Postgres 11 release notes

2018-05-13 Thread Amit Kapila
On Sun, May 13, 2018 at 4:40 PM, Amit Kapila wrote: > On Fri, May 11, 2018 at 8:38 PM, Bruce Momjian wrote: >> I have committed the first draft of the Postgres 11 release notes. I >> will add more markup soon. You can view the most current version

Re: Indexes on partitioned tables and foreign partitions

2018-05-13 Thread Robert Haas
On Fri, May 11, 2018 at 8:52 AM, Simon Riggs wrote: > I think its reasonable to expect you interpret my words sensibly, > rather than in some more dramatic form where I seem to break rules > with every phrase. Sure, I agree. I try to interpret the words of everyone here

Re: Postgres 11 release notes

2018-05-13 Thread Michael Paquier
On Fri, May 11, 2018 at 11:08:52AM -0400, Bruce Momjian wrote: > I have committed the first draft of the Postgres 11 release notes. I > will add more markup soon. You can view the most current version > here: Thanks for gathering all the commits in one piece, Bruce. > I expect a torrent of

Re: Postgres 11 release notes

2018-05-13 Thread Đặng Minh Hướng
Hello Bruce, Thanks for the greate work! 2018-05-12 0:08 GMT+09:00 Bruce Momjian : > I have committed the first draft of the Postgres 11 release notes. I > will add more markup soon. You can view the most current version here: > >

Re: Why does load_external_function() return PGFunction?

2018-05-13 Thread Tom Lane
Robert Haas writes: > On Thu, May 10, 2018 at 4:45 PM, Andres Freund wrote: >> IMO the important >> part isn't that the parameters fit exactly - we'll have to cast for the >> return type anyway - but that it's declared as a pointer-to-function for >>

Re: Allow COPY's 'text' format to output a header

2018-05-13 Thread David Steele
Hi Simon, On 5/13/18 6:18 PM, Simon Muller wrote: > This patch adds the capability to use the HEADER feature with the "text" > format of the COPY command. The patch includes the related update to > documentation and an additional regression test for this feature. > > Currently you can only add a

An out-of-date comment in nodeIndexonlyscan.c

2018-05-13 Thread Thomas Munro
Hello, Since commit cdf91edb (2012), nodeIndexonlyscan.c says: /* * Predicate locks for index-only scans must be acquired at the page * level when the heap is not accessed, since tuple-level predicate * locks need the tuple's

Re: Postgres 11 release notes

2018-05-13 Thread Michael Paquier
On Sun, May 13, 2018 at 03:43:08PM +0900, Michael Paquier wrote: > On Fri, May 11, 2018 at 11:08:52AM -0400, Bruce Momjian wrote: > > I have committed the first draft of the Postgres 11 release notes. I > > will add more markup soon. You can view the most current version > > here: > > Thanks

Re: Allow COPY's 'text' format to output a header

2018-05-13 Thread Michael Paquier
On Sun, May 13, 2018 at 07:01:00PM -0400, David Steele wrote: > This patch makes sense to me and looks reasonable. One "potential" problem is if a relation has a full set of column which allows the input of text-like data: if the header has been added with COPY TO, and that the user forgets to

Re: postgres_fdw: Oddity in pushing down inherited UPDATE/DELETE joins to remote servers

2018-05-13 Thread Amit Langote
On 2018/05/11 21:48, Etsuro Fujita wrote: > (2018/05/11 16:19), Amit Langote wrote: >> On 2018/05/11 16:12, Amit Langote wrote: >>> Just to clarify, does this problem only arise because there is a pushed >>> down join involving the child? That is, does the problem only occur as of >>> the

Allow COPY's 'text' format to output a header

2018-05-13 Thread Simon Muller
This patch adds the capability to use the HEADER feature with the "text" format of the COPY command. The patch includes the related update to documentation and an additional regression test for this feature. Currently you can only add a header line (which lists the column names) when exporting

Re: Should we add GUCs to allow partition pruning to be disabled?

2018-05-13 Thread David Rowley
On 13 May 2018 at 03:30, Alvaro Herrera wrote: > Amit Langote wrote: > >> +1 to this more radical overhaul of this part of the documentation. > > Thanks. I pushed now after some more tweaking, Thanks for pushing. -- David Rowley

Re: Should we add GUCs to allow partition pruning to be disabled?

2018-05-13 Thread Amit Langote
On 2018/05/14 9:55, David Rowley wrote: > On 13 May 2018 at 03:30, Alvaro Herrera wrote: >> Amit Langote wrote: >> >>> +1 to this more radical overhaul of this part of the documentation. >> >> Thanks. I pushed now after some more tweaking, > > Thanks for pushing.

Re: [HACKERS] Surjective functional indexes

2018-05-13 Thread Robert Haas
On Fri, May 11, 2018 at 11:01 AM, Simon Riggs wrote: >>> I have no problem if you want to replace this with an even better >>> design in a later release. >> >> Meh. The author / committer should get a patch into the right shape > > They have done, at length. Claiming

\d doesn't show partitioned table foreign keys

2018-05-13 Thread Amit Langote
Hi. I just noticed $subject, which attached seems to fix, although not sure if that's the correct fix for the issue. create table foo (a int primary key); create table doo (a int primary key); create table bar (a int references foo references doo) partition by list (a); create table bar1

Re: \d doesn't show partitioned table foreign keys

2018-05-13 Thread Amit Langote
On 2018/05/14 11:50, Amit Langote wrote: > Hi. > > I just noticed $subject, which attached seems to fix, although not sure if > that's the correct fix for the issue. I updated the comment above the changed code to explain things as I see them. Attached updated patch. Thanks, Amit diff --git