Re: [HACKERS] Incorrect comment for build_child_join_rel

2017-11-12 Thread Etsuro Fujita
(2017/11/11 0:58), Robert Haas wrote: On Fri, Nov 10, 2017 at 4:34 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: Here is a small patch for $Subject. Good catch. Committed. Thanks! Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgres

Re: [HACKERS] Another oddity in handling of WCO constraints in postgres_fdw

2017-11-10 Thread Etsuro Fujita
don't need to ensure those constraints locally. But I'm not sure if the same thing applies to WCOs on views defined on foreign tables, because in some case it's not possible to impose constraints on the remote side that match those WCOs, as I explained before. Best regards, Etsuro Fujita -

[HACKERS] Incorrect comment for build_child_join_rel

2017-11-10 Thread Etsuro Fujita
Hi, Here is a small patch for $Subject. Best regards, Etsuro Fujita *** a/src/backend/optimizer/util/relnode.c --- b/src/backend/optimizer/util/relnode.c *** *** 676,683 build_join_rel(PlannerInfo *root, * 'sjinfo': child-join context info * 'restrictlist': list

[HACKERS] Reorder header files in alphabetical order

2017-11-09 Thread Etsuro Fujita
Hi, Attached is a patch to reorder header files in joinrels.c and pathnode.c in alphabetical order, removing unnecessary ones. Best regards, Etsuro Fujita *** a/src/backend/optimizer/path/joinrels.c --- b/src/backend/optimizer/path/joinrels.c *** *** 16,30 #include

Re: [HACKERS] Comment typo

2017-10-31 Thread Etsuro Fujita
On 2017/10/30 22:39, Magnus Hagander wrote: On Mon, Oct 30, 2017 at 3:49 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp <mailto:fujita.ets...@lab.ntt.co.jp>> wrote: Here is a patch to fix a typo in a comment in partition.c: s/specificiation/specification/. Applied, tha

[HACKERS] Comment typo

2017-10-29 Thread Etsuro Fujita
Here is a patch to fix a typo in a comment in partition.c: s/specificiation/specification/. Best regards, Etsuro Fujita diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c index 07fdf66..e234167 100644 --- a/src/backend/catalog/partition.c +++ b/src/backend/catalog

Re: [HACKERS] Typos in src/backend/optimizer/README

2017-10-29 Thread Etsuro Fujita
On 2017/10/28 18:15, Robert Haas wrote: On Fri, Oct 27, 2017 at 9:34 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: This sentence in the section of Partition-wise joins in src/backend/optimizer/README should be fixed: "This technique of breaking down a join between parti

Re: [HACKERS] Add support for tuple routing to foreign partitions

2017-10-27 Thread Etsuro Fujita
On 2017/10/26 16:40, Etsuro Fujita wrote: Other changes I made to the executor are: (1) currently, we set the RT index for the root partitioned table to ri_RangeTableIndex of partitions' ResultRelInfos, but the proposed EXPLAIN requires that the partition's ri_RangeTableIndex is set to the RT

[HACKERS] Typos in src/backend/optimizer/README

2017-10-27 Thread Etsuro Fujita
in between partitioned tables/ (2) s/join between their partitions/joins between their partitions/ It might be okay to leave #2 as-is, but I'd like to propose to change that way to make the meaning clear. Attached is a patch for that. Best regards, Etsuro Fujita diff --git a/src/backend/optimize

Re: [HACKERS] Add support for tuple routing to foreign partitions

2017-10-26 Thread Etsuro Fujita
Hi Maksim, On 2017/10/02 21:37, Maksim Milyutin wrote: On 11.09.2017 16:01, Etsuro Fujita wrote: * Query planning: the patch creates copies of Query/Plan with a foreign partition as target from the original Query/Plan for each foreign partition and invokes PlanForeignModify with those copies

Re: [HACKERS] Another oddity in handling of WCO constraints in postgres_fdw

2017-10-06 Thread Etsuro Fujita
, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Comment typo

2017-10-06 Thread Etsuro Fujita
On 2017/10/05 21:48, Robert Haas wrote: On Thu, Oct 5, 2017 at 6:11 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: Here is a small patch to fix a typo in a comment in partition.c: s/mantain/maintain/. Committed. Thanks! Best regards, Etsuro Fujita -- Sent via pgsql-h

[HACKERS] Comment typo

2017-10-05 Thread Etsuro Fujita
Here is a small patch to fix a typo in a comment in partition.c: s/mantain/maintain/. Best regards, Etsuro Fujita diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c index 1ab6dba..9777d40 100644 --- a/src/backend/catalog/partition.c +++ b/src/backend/catalog

Re: [HACKERS] Another oddity in handling of WCO constraints in postgres_fdw

2017-10-05 Thread Etsuro Fujita
example of precedence where we ignore what's happening on remote side and enforce whatever we could enforce locally. Local server should make sure that any rows sent from local server to the remote server do not violate any local WCO. Seems odd (and too restrictive) to me too. Best regards, Etsuro

Re: [HACKERS] Another oddity in handling of WCO constraints in postgres_fdw

2017-10-04 Thread Etsuro Fujita
with check option; how is the WCO constraint (ie, a % 4 = 0) ensured remotely, which is different from the constraint on the foreign table (ie, a % 2 = 0)? Maybe I'm missing something, though. Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make

[HACKERS] Another oddity in handling of WCO constraints in postgres_fdw

2017-09-28 Thread Etsuro Fujita
ing postgresPlanForeignModify so that it handles WCO the same way as for the RETURNING case. Attached is a patch for that. I'll add the patch to the next commitfest. Best regards, Etsuro Fujita *** a/contrib/postgres_fdw/deparse.c --- b/contrib/postgres_fdw/deparse.c *** *** 138,

Re: [HACKERS] postgres_fdw: evaluate placeholdervars on remote server

2017-09-26 Thread Etsuro Fujita
-forth during the CF is of course to be expected, but we don't even really have enough bandwidth to deal with the patches that are being timely updated, never mind the ones that aren't. Agreed. I marked this as RWF. Thank you. Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list

Re: [HACKERS] Add support for tuple routing to foreign partitions

2017-09-11 Thread Etsuro Fujita
On 2017/08/17 17:27, Etsuro Fujita wrote: On 2017/07/11 6:56, Robert Haas wrote: I have to admit that I'm a little bit fuzzy about why foreign insert routing requires all of these changes.  I think this patch would benefit from being accompanied by several paragraphs of explanation outlining

Re: [HACKERS] Tuple-routing for certain partitioned tables not working as expected

2017-09-07 Thread Etsuro Fujita
On 2017/09/08 0:21, Robert Haas wrote: On Thu, Sep 7, 2017 at 5:13 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: On 2017/08/30 17:20, Etsuro Fujita wrote: Here is a patch to skip the CheckValidResultRel checks for a target table if it's a foreign partition to perform tuple-r

Re: [HACKERS] Tuple-routing for certain partitioned tables not working as expected

2017-09-07 Thread Etsuro Fujita
On 2017/08/30 17:20, Etsuro Fujita wrote: Here is a patch to skip the CheckValidResultRel checks for a target table if it's a foreign partition to perform tuple-routing for, as proposed by Robert. In the patch, to skip the checks, I passed to CheckValidResultRel a new flag indicating whether

Re: [HACKERS] Tuple-routing for certain partitioned tables not working as expected

2017-09-05 Thread Etsuro Fujita
On 2017/08/30 17:20, Etsuro Fujita wrote: On 2017/08/30 9:13, Amit Langote wrote: On 2017/08/29 20:18, Etsuro Fujita wrote: On 2017/08/25 22:26, Robert Haas wrote: On Wed, Aug 23, 2017 at 4:55 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: Agreed, but I'd vote for fixing this

Re: [HACKERS] postgres_fdw bug in 9.6

2017-09-05 Thread Etsuro Fujita
m better. I think Tom is reviewing this patch [1]. Best regards, Etsuro Fujita [1] https://www.postgresql.org/message-id/22168.1504041271%40sss.pgh.pa.us -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

[HACKERS] Copyright in partition.h and partition.c

2017-09-05 Thread Etsuro Fujita
) 1994, Regents of the University of California Is that intentional? Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Partition-wise join for join between (declaratively) partitioned tables

2017-09-05 Thread Etsuro Fujita
entries corresponding to the partitioned tables, and traditionally, the executor looks at those lists to figure out the tables to lock. I think so too. Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http

Re: [HACKERS] Partition-wise join for join between (declaratively) partitioned tables

2017-09-04 Thread Etsuro Fujita
est regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Useless code in ExecInitModifyTable

2017-09-04 Thread Etsuro Fujita
On 2017/06/21 17:57, Amit Langote wrote: On 2017/06/21 16:59, Etsuro Fujita wrote: Commit d3cc37f1d801a6b5cad9bf179274a8d767f1ee50 added this to ExecInitModifyTable: + /* The root table RT index is at the head of the partitioned_rels list */ + if (node->partitioned_r

Re: [HACKERS] Partition-wise join for join between (declaratively) partitioned tables

2017-09-03 Thread Etsuro Fujita
ch yet, I think the above code is useless. And I proposed a patch to clean it up before [1]. I'll add that patch to the next commitfest. Best regards, Etsuro Fujita [1] https://www.postgresql.org/message-id/93cf9816-2f7d-0f67-8ed2-4a4e497a6ab8%40lab.ntt.co.jp -- Sent via pgsql-hackers mail

Re: [HACKERS] Minor code improvement to postgresGetForeignPlan

2017-09-01 Thread Etsuro Fujita
I'm not sure we should do the same thing to the function declaration in other places such as fdwapi.h and the documentation for consistency, but if so, I'd vote for leaving that for another patch.) Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.

Re: [HACKERS] Update comment in ExecPartitionCheck

2017-09-01 Thread Etsuro Fujita
On 2017/08/26 2:28, Robert Haas wrote: On Tue, Jul 4, 2017 at 4:55 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: This comment in an error handling in ExecPartitionCheck(): if (!ExecCheck(resultRelInfo->ri_PartitionCheckExpr, econtext)) { char

Re: [HACKERS] Add support for tuple routing to foreign partitions

2017-09-01 Thread Etsuro Fujita
On 2017/08/26 1:43, Robert Haas wrote: On Sun, Aug 20, 2017 at 11:25 PM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: I agree, but I wonder if we ought to make it work first using the existing APIs and then add these new APIs as an optimization. I'm not sure that's a good idea b

Re: [HACKERS] Tuple-routing for certain partitioned tables not working as expected

2017-08-30 Thread Etsuro Fujita
On 2017/08/30 9:13, Amit Langote wrote: On 2017/08/29 20:18, Etsuro Fujita wrote: On 2017/08/25 22:26, Robert Haas wrote: On Wed, Aug 23, 2017 at 4:55 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: Agreed, but I'd vote for fixing this in v10 as proposed; I agree that just r

Re: [HACKERS] Tuple-routing for certain partitioned tables not working as expected

2017-08-29 Thread Etsuro Fujita
On 2017/08/25 22:26, Robert Haas wrote: On Wed, Aug 23, 2017 at 4:55 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: Agreed, but I'd vote for fixing this in v10 as proposed; I agree that just ripping the CheckValidResultRel checks out entirely is not a good idea, but that seems OK

Re: [HACKERS] postgres_fdw bug in 9.6

2017-08-29 Thread Etsuro Fujita
On 2017/08/21 20:37, Etsuro Fujita wrote: Attached is an updated version of the patch. I corrected some comments. New version attached. Best regards, Etsuro Fujita *** a/contrib/postgres_fdw/expected/postgres_fdw.out --- b/contrib/postgres_fdw/expected/postgres_fdw.out

Re: [HACKERS] Tuple-routing for certain partitioned tables not working as expected

2017-08-23 Thread Etsuro Fujita
On 2017/08/22 9:55, Amit Langote wrote: On 2017/08/22 1:08, Robert Haas wrote: On Mon, Aug 21, 2017 at 7:45 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: If there are no objections, I'll add this to the open item list for v10. This seems fairly ad-hoc to me. I mean, now yo

Re: [HACKERS] Tuple-routing for certain partitioned tables not working as expected

2017-08-21 Thread Etsuro Fujita
On 2017/08/07 15:45, Etsuro Fujita wrote: On 2017/08/07 15:33, Amit Langote wrote: On 2017/08/07 15:22, Etsuro Fujita wrote: On 2017/08/07 13:11, Amit Langote wrote:> The patch looks good too. Although, looking at the following hunk: + Assert(partrel->rd_rel-&g

Re: [HACKERS] postgres_fdw bug in 9.6

2017-08-21 Thread Etsuro Fujita
ll propose that as part of the patch in [1].) There's probably more to think about here, but those are my question on an initial read-through. Thanks for the review! Attached is an updated version of the patch. Best regards, Etsuro Fujita [1] https://commitfest.postgresql.org/14/1042/ *** a/co

[HACKERS] Re: Stats for triggers on partitioned tables not shown in EXPLAIN ANALYZE

2017-08-20 Thread Etsuro Fujita
at.com Committed and back-patched the proposed patch. Thanks. Thank you! Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Add support for tuple routing to foreign partitions

2017-08-20 Thread Etsuro Fujita
On 2017/08/19 2:12, Robert Haas wrote: On Thu, Aug 17, 2017 at 4:27 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: I think that would be much more efficient than INSERTing tuples into the remote server one by one. What do you think about that? I agree, but I wonder if we

Re: [HACKERS] Add support for tuple routing to foreign partitions

2017-08-20 Thread Etsuro Fujita
On 2017/08/18 22:41, David Fetter wrote: On Fri, Aug 18, 2017 at 05:10:29PM +0900, Etsuro Fujita wrote: On 2017/08/17 23:48, David Fetter wrote: On Thu, Aug 17, 2017 at 05:27:05PM +0900, Etsuro Fujita wrote: On 2017/07/11 6:56, Robert Haas wrote: On Thu, Jun 29, 2017 at 6:20 AM, Etsuro

Re: [HACKERS] Add support for tuple routing to foreign partitions

2017-08-18 Thread Etsuro Fujita
On 2017/08/17 23:48, David Fetter wrote: On Thu, Aug 17, 2017 at 05:27:05PM +0900, Etsuro Fujita wrote: On 2017/07/11 6:56, Robert Haas wrote: On Thu, Jun 29, 2017 at 6:20 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: So, I dropped the COPY part. Ouch. I think we shou

Re: [HACKERS] postgres_fdw bug in 9.6

2017-08-17 Thread Etsuro Fujita
On 2017/08/18 8:16, Michael Paquier wrote: On Fri, Aug 18, 2017 at 3:59 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: Robert Haas <robertmh...@gmail.com> writes: On Thu, Aug 17, 2017 at 8:00 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: I rebased the patch to HEAD.

Re: [HACKERS] Garbled comment in postgresGetForeignJoinPaths

2017-08-17 Thread Etsuro Fujita
tch for addressing the GetExistingLocalJoinPath issue [1]. Best regards, Etsuro Fujita [1] https://www.postgresql.org/message-id/6008ca34-906f-e61d-478b-8f85fde2c090%40lab.ntt.co.jp -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: h

Re: [HACKERS] postgres_fdw bug in 9.6

2017-08-17 Thread Etsuro Fujita
On 2017/04/04 18:01, Etsuro Fujita wrote: I rebased the patch also. Please find attached an updated version of the patch. I rebased the patch to HEAD. PFA a new version of the patch. Best regards, Etsuro Fujita *** a/contrib/postgres_fdw/expected/postgres_fdw.out --- b/contrib/postgres_fdw

Re: [HACKERS] Add support for tuple routing to foreign partitions

2017-08-17 Thread Etsuro Fujita
On 2017/08/17 20:37, Ashutosh Bapat wrote: On Thu, Aug 17, 2017 at 1:57 PM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: I spent some time on this. To handle that, I'd like to propose doing something similar to \copy (frontend copy): submit a COPY query "COPY ...

Re: [HACKERS] Add support for tuple routing to foreign partitions

2017-08-17 Thread Etsuro Fujita
On 2017/07/11 6:56, Robert Haas wrote: On Thu, Jun 29, 2017 at 6:20 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: So, I dropped the COPY part. Ouch. I think we should try to figure out how the COPY part will be handled before we commit to a design. I spent som

[HACKERS] Stats for triggers on partitioned tables not shown in EXPLAIN ANALYZE

2017-08-15 Thread Etsuro Fujita
dified ExecGetTriggerResultRel so that it searches es_leaf_result_relations and es_root_result_relations in addition to es_result_relations. Best regards, Etsuro Fujita *** a/src/backend/commands/copy.c --- b/src/backend/commands/copy.c *** *** 1415,1473 BeginCopy(ParseState *

Re: [HACKERS] Comment typo in plannodes.h

2017-08-13 Thread Etsuro Fujita
On 2017/08/11 2:18, Robert Haas wrote: On Thu, Aug 10, 2017 at 8:25 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: Here is a small patch for fixing a comment typo in plannodes.h: s/all the partitioned table/all the partitioned tables/. Committed. Thank you. Best regards,

[HACKERS] Comment typo in plannodes.h

2017-08-10 Thread Etsuro Fujita
Hi, Here is a small patch for fixing a comment typo in plannodes.h: s/all the partitioned table/all the partitioned tables/. Best regards, Etsuro Fujita diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index f1a1b24..7c51e7f 100644 --- a/src/include/nodes/plannodes.h

Re: [HACKERS] Tuple-routing for certain partitioned tables not working as expected

2017-08-07 Thread Etsuro Fujita
On 2017/08/07 15:33, Amit Langote wrote: On 2017/08/07 15:22, Etsuro Fujita wrote: On 2017/08/07 13:11, Amit Langote wrote:> The patch looks good too. Although, looking at the following hunk: + Assert(partrel->rd_rel->relkind == RELKIND_RELATION || +partre

Re: [HACKERS] Tuple-routing for certain partitioned tables not working as expected

2017-08-07 Thread Etsuro Fujita
here is a new version which removes the verification at all from ExecSetupPartitionTupleRouting. Best regards, Etsuro Fujita *** /dev/null --- b/contrib/file_fdw/data/list1.csv *** *** 0 --- 1,2 + 1,foo + 1,bar *** /dev/null --- b/contrib/file_fdw/data/list2.bad *

[HACKERS] Tuple-routing for certain partitioned tables not working as expected

2017-08-06 Thread Etsuro Fujita
t. Since COPY FROM has the same issue, I added regression tests for COPY FROM as well as INSERT to file_fdw. Best regards, Etsuro Fujita *** /dev/null --- b/contrib/file_fdw/data/list1.csv *** *** 0 --- 1,2 + 1,foo + 1,bar *** /dev/null --- b/contrib/file_fdw/data/list2.ba

Re: [HACKERS] Update comments in nodeModifyTable.c

2017-08-03 Thread Etsuro Fujita
On 2017/08/04 1:52, Robert Haas wrote: On Thu, Aug 3, 2017 at 5:55 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: I updated the patch that way. Attached is a new version of the patch. Committed. Thanks again. Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailin

Re: [HACKERS] map_partition_varattnos() and whole-row vars

2017-08-03 Thread Etsuro Fujita
On 2017/08/04 10:00, Amit Langote wrote: On 2017/08/04 1:06, Robert Haas wrote: On Thu, Aug 3, 2017 at 4:40 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: On 2017/08/03 17:12, Amit Langote wrote: Attached updated patches. Thanks for the patch! That looks good to me. Com

Re: [HACKERS] Update comments in nodeModifyTable.c

2017-08-03 Thread Etsuro Fujita
On 2017/08/02 4:07, Robert Haas wrote: On Tue, Aug 1, 2017 at 12:31 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: Maybe I'm missing something, but I'm not sure that's a good idea because the change says like we might have 'wholerow' only for the FDW case, but that isn't correct b

Re: [HACKERS] map_partition_varattnos() and whole-row vars

2017-08-03 Thread Etsuro Fujita
On 2017/08/03 17:12, Amit Langote wrote: Attached updated patches. Thanks for the patch! That looks good to me. Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql

Re: [HACKERS] map_partition_varattnos() and whole-row vars

2017-08-03 Thread Etsuro Fujita
On 2017/08/02 15:21, Amit Langote wrote: Thanks Fuita-san and Amit for reviewing. On 2017/08/02 1:33, Amit Khandekar wrote: On 1 August 2017 at 15:11, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: On 2017/07/31 18:56, Amit Langote wrote: Yes, that's what's needed here. So w

Re: [HACKERS] map_partition_varattnos() and whole-row vars

2017-08-02 Thread Etsuro Fujita
review or coding that needs to be done here? I'll take another look at the patch from now. Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Another comment typo in execMain.c

2017-08-02 Thread Etsuro Fujita
On 2017/08/01 6:09, Peter Eisentraut wrote: On 7/6/17 03:23, Etsuro Fujita wrote: Here is a comment in ExecFindPartition() in execMain.c: /* * First check the root table's partition constraint, if any. No point in * routing the tuple it if it doesn't belong in the root

Re: [HACKERS] map_partition_varattnos() and whole-row vars

2017-08-01 Thread Etsuro Fujita
return (Node *) r; + } I think we could set r->resulttype to the vartype (ie, "r->resulttype = newvar->vartype" instead of "r->resulttype = context->from_rowtype"). Best regards, Etsuro Fujita --

Re: [HACKERS] Update comments in nodeModifyTable.c

2017-07-31 Thread Etsuro Fujita
On 2017/08/01 1:03, Robert Haas wrote: On Fri, Jul 28, 2017 at 8:12 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: On 2017/07/26 22:39, Robert Haas wrote: So the first part of the change weakens the assertion that a 'ctid' or 'wholerow' attribute will always be present by

Re: [HACKERS] [BUGS] BUG #14759: insert into foreign data partitions fail

2017-07-31 Thread Etsuro Fujita
constraints? Other than that, the patch looks good to me. Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Update comments in nodeModifyTable.c

2017-07-28 Thread Etsuro Fujita
On 2017/07/26 22:39, Robert Haas wrote: On Wed, Jun 14, 2017 at 10:40 PM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: Attached is an updated version of the patch. Well, now I'm confused: * Initialize the junk filter(s) if needed. INSERT queries need a

Re: [HACKERS] [BUGS] BUG #14759: insert into foreign data partitions fail

2017-07-28 Thread Etsuro Fujita
nstraint" along with the traditional constraints such as NOT NULL and CHECK constraints, which we can do for local table partitions but not for foreign table ones. Anyway, attached patch documents all these limitations about foreign table partitions more prominently. Typo: s/the they is/they a

Re: [HACKERS] UPDATE of partition key

2017-07-26 Thread Etsuro Fujita
esult much readable. Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Mishandling of WCO constraints in direct foreign table modification

2017-07-25 Thread Etsuro Fujita
On 2017/07/25 5:35, Robert Haas wrote: On Fri, Jul 21, 2017 at 6:21 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: I mean constraints derived from WITH CHECK OPTIONs specified for parent views. We use the words "WITH CHECK OPTION constraints" in comments in nodeM

Re: [HACKERS] Oddity in error handling of constraint violation in ExecConstraints for partitioned tables

2017-07-24 Thread Etsuro Fujita
() ? I see that there is a do_convert_tuple() in that function, again without changing the slot descriptor. Yeah, I think we would need that in ExecPartitionCheck() as well. Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes t

Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables

2017-07-23 Thread Etsuro Fujita
On 2017/07/21 19:16, Etsuro Fujita wrote: On 2017/07/20 11:21, Etsuro Fujita wrote: On 2017/07/19 23:36, Tom Lane wrote: Please put the responsibility of doing const-expression simplification in these cases somewhere closer to where the problem is being created. It would be reasonable

Re: [HACKERS] Mishandling of WCO constraints in direct foreign table modification

2017-07-21 Thread Etsuro Fujita
On 2017/07/21 17:18, Kyotaro HORIGUCHI wrote: At Fri, 21 Jul 2017 12:00:03 +0900, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote in <15aa9936-9bd8-c9e3-7ca1-394861073...@lab.ntt.co.jp> Attached is the second version which updated docs in postgres-fdw.sgml as well. !no

Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables

2017-07-21 Thread Etsuro Fujita
On 2017/07/20 11:21, Etsuro Fujita wrote: On 2017/07/19 23:36, Tom Lane wrote: Please put the responsibility of doing const-expression simplification in these cases somewhere closer to where the problem is being created. It would be reasonable that it's the FDW's responsibility to do

Re: [HACKERS] Mishandling of WCO constraints in direct foreign table modification

2017-07-20 Thread Etsuro Fujita
On 2017/07/21 3:24, Robert Haas wrote: I think that's reasonable. This should be committed and back-patched to 9.6, right? Yeah, because direct modify was introduced in 9.6. Attached is the second version which updated docs in postgres-fdw.sgml as well. Best regards, Etsuro Fujita

[HACKERS] Mishandling of WCO constraints in direct foreign table modification

2017-07-20 Thread Etsuro Fujita
giving up direct modify if there are any WITH CHECK OPTIONs. Attached is a patch for that. I'll add it to the next commitfest. Best regards, Etsuro Fujita *** a/contrib/postgres_fdw/expected/postgres_fdw.out --- b/contrib/postgres_fdw/expected/postgres_fdw.out *** *** 5856,5861 **

Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables

2017-07-19 Thread Etsuro Fujita
On 2017/07/19 23:36, Tom Lane wrote: Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> writes: * Modified rewrite_targetlist(), which is a new function added to preptlist.c, so that we do const-simplification to junk TLEs that AddForeignUpdateTargets() added, as that API allows the FDW to ad

Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables

2017-07-19 Thread Etsuro Fujita
On 2017/07/13 21:10, Etsuro Fujita wrote: Attached is an updated version of the patch. Here is an updated version of the patch. Changes are: * Modified rewrite_targetlist(), which is a new function added to preptlist.c, so that we do const-simplification to junk TLEs

[HACKERS] Re: Oddity in error handling of constraint violation in ExecConstraints for partitioned tables

2017-07-18 Thread Etsuro Fujita
On 2017/07/18 11:03, Robert Haas wrote: On Mon, Jul 10, 2017 at 5:44 PM, Robert Haas <robertmh...@gmail.com> wrote: The posted patches look OK to me. Barring developments, I will commit them on 2017-07-17, or send another update by then. Committed them. Thank you! Best regards,

Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables

2017-07-13 Thread Etsuro Fujita
On 2017/06/30 18:44, Etsuro Fujita wrote: On 2017/06/16 21:29, Etsuro Fujita wrote: I'll have second thought about this, so I'll mark this as waiting on author. I spent quite a bit of time on this and came up with a solution for addressing the concern mentioned by Ashutosh [1]. The basic

Re: [HACKERS] Oddity in error handling of constraint violation in ExecConstraints for partitioned tables

2017-07-09 Thread Etsuro Fujita
On 2017/07/07 18:47, Amit Langote wrote: On 2017/07/06 16:06, Etsuro Fujita wrote: I think this should be fixed. Attached is a patch for that. Looking up the ResultRelInfo using the proposed method in ExecFindResultRelInfo() can be unreliable sometimes, that is, the method of using the root

Re: [HACKERS] Add support for tuple routing to foreign partitions

2017-07-06 Thread Etsuro Fujita
On 2017/07/05 9:13, Amit Langote wrote: On 2017/06/29 20:20, Etsuro Fujita wrote: In relation to this, I also allowed expand_inherited_rtentry() to build an RTE and AppendRelInfo for each partition of a partitioned table that is an INSERT target, as mentioned by Amit in [1], by modifying

[HACKERS] Another comment typo in execMain.c

2017-07-06 Thread Etsuro Fujita
t;if" is a typo. Attached is a small patch for fixing that. Best regards, Etsuro Fujita diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 0f08283..06b467b 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -3310,7 +3310,7

[HACKERS] Oddity in error handling of constraint violation in ExecConstraints for partitioned tables

2017-07-06 Thread Etsuro Fujita
le isn't the primary ModifyTable node*, which leads to deriving an incorrect modifiedCols and then invoking ExecBuildSlotValueDescription with the wrong bitmap. I think this should be fixed. Attached is a patch for that. Best regards, Etsuro Fujita *** a/src/backend/executor/execMain.c --- b/src/b

Re: [HACKERS] Update comment in ExecPartitionCheck

2017-07-06 Thread Etsuro Fujita
On 2017/07/04 18:15, Amit Langote wrote: On 2017/07/04 17:55, Etsuro Fujita wrote: This comment in an error handling in ExecPartitionCheck(): if (!ExecCheck(resultRelInfo->ri_PartitionCheckExpr, econtext)) { char *val_desc; Relationorig_rel =

[HACKERS] Update comment in ExecPartitionCheck

2017-07-04 Thread Etsuro Fujita
. Best regards, Etsuro Fujita diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 0f08283..dcf685a 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -1864,7 +1864,7 @@ ExecPartitionCheck(ResultRelInfo *resultRelInfo, Tupl

Re: [HACKERS] UPDATE of partition key

2017-07-04 Thread Etsuro Fujita
, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables

2017-06-30 Thread Etsuro Fujita
On 2017/06/16 21:29, Etsuro Fujita wrote: On 2017/06/16 19:26, Ashutosh Bapat wrote: That issue has not been addressed. The reason stated was that it would make code complicated. But I have not had chance to look at how complicated would be and assess myself whether that's worth the trouble

Re: [HACKERS] Declarative partitioning - another take

2017-06-29 Thread Etsuro Fujita
Hi Maksim, On 2017/04/07 19:52, Maksim Milyutin wrote: On 07.04.2017 13:05, Etsuro Fujita wrote: On 2016/12/09 19:46, Maksim Milyutin wrote: I would like to work on two tasks: - insert (and eventually update) tuple routing for foreign partition. - the ability to create an index

[HACKERS] Add support for tuple routing to foreign partitions

2017-06-29 Thread Etsuro Fujita
($1) Foreign Insert on public.fp2 Remote SQL: INSERT INTO public.t2(a) VALUES ($1) -> Values Scan on "*VALUES*" (cost=0.00..0.03 rows=2 width=4) Output: "*VALUES*".column1 (7 rows) Comments are welcome! Anyway, I'll add this to the next commitfest

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 <fujita.ets...@lab.ntt.co.jp> 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 ar

Re: [HACKERS] Useless code in ExecInitModifyTable

2017-06-21 Thread Etsuro Fujita
*/ List *partitioned_rels; I agree on that point, but I think it's better to add the missing comment for the create_modifytable_path argument, as proposed in [1]. Best regards, Etsuro Fujita [1] https://www.postgresql.org/message-id/e87c4a6d-23d7-5e7c-e8db-44ed418eb5d1%40lab.ntt.co.jp

[HACKERS] Comment typo in execMain.c

2017-06-21 Thread Etsuro Fujita
Here is a patch to fix a typo in a comment in ExecWithCheckOptions(): s/as as/as/. Best regards, Etsuro Fujita diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 7f460bd..9dbe175 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c

[HACKERS] Useless code in ExecInitModifyTable

2017-06-21 Thread Etsuro Fujita
to propose to remove this from that function. Attached is a patch for that. Best regards, Etsuro Fujita *** a/src/backend/executor/nodeModifyTable.c --- b/src/backend/executor/nodeModifyTable.c *** *** 45,51 #include "foreign/fdwapi.h" #include "miscadmin.h&quo

Re: [HACKERS] Missing comment for ResultRelInfo in execnodes.h

2017-06-20 Thread Etsuro Fujita
On 2017/06/21 3:30, Peter Eisentraut wrote: On 6/20/17 05:50, Etsuro Fujita wrote: Here is a small patch to add a comment on its new member PartitionRoot. The existing comment style is kind of unusual. How about the attached to clean it up a bit? +1 for that change. Best regards, Etsuro

[HACKERS] Missing comment for ResultRelInfo in execnodes.h

2017-06-20 Thread Etsuro Fujita
Here is a small patch to add a comment on its new member PartitionRoot. Best regards, Etsuro Fujita diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index d33392f..7175a42 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -365,6 +365,7

Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables

2017-06-16 Thread Etsuro Fujita
On 2017/06/16 19:26, Ashutosh Bapat wrote: On Fri, Jun 16, 2017 at 3:35 PM, Etsuro Fujita Ashutosh mentioned his concern about what I proposed above before [2], but I'm not sure we should address that. And there have been no opinions from him (or anyone else) since then. So, I'd like to leave

Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables

2017-06-16 Thread Etsuro Fujita
different foreign servers with different FDWs since it applies rewriteTargetListUD to each child table when generating a modified query with that child table with the target in inheritance_planner. I didn't any regression tests for that, though. Best regards, Etsuro Fujita -- Sent via

Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables

2017-06-16 Thread Etsuro Fujita
evised some comments a bit. I didn't make any functional changes, so I'll keep this Ready for Committer. Best regards, Etsuro Fujita [2] https://www.postgresql.org/message-id/CAFjFpRfTpamoUz6fNyk6gPh%3DecfBJjbUHJNKbDxscpyPJ3FfjQ%40mail.gmail.com *** a/contrib/postgres_fdw/expected/postgres_f

[HACKERS] Missing comment for create_modifytable_path

2017-06-15 Thread Etsuro Fujita
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 including that in the comments for that function. Best regards, Etsuro Fujita diff

Re: [HACKERS] Update comments in nodeModifyTable.c

2017-06-14 Thread Etsuro Fujita
On 2017/06/07 0:30, Robert Haas wrote: On Mon, Jun 5, 2017 at 4:45 AM, Etsuro Fujita <fujita.ets...@lab.ntt.co.jp> wrote: While working on [1], I noticed that the comment in ExecModifyTable: * Foreign table updates have a wholerow attribut

Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables

2017-06-05 Thread Etsuro Fujita
On 2017/06/05 17:39, Ashutosh Bapat wrote: On Fri, Jun 2, 2017 at 2:40 PM, Etsuro Fujita While updating the patch, I noticed the patch rewrites the UPDATE targetList incorrectly in some cases; rewrite_inherited_tlist I added to adjust_appendrel_attrs (1) removes all junk items from

[HACKERS] Update comments in nodeModifyTable.c

2017-06-05 Thread Etsuro Fujita
an AFTER ROW or BEFORE ROW trigger (see rewriteTargetListUD). So I'd propose s/an AFTER ROW trigger/a row-level trigger/. Attached is a patch for that. Best regards, Etsuro Fujita [1] https://www.postgresql.org/message-id/a31f779e-9cb8-1ea5-71a6-bca6adbfa6a4%40lab.ntt.co.jp diff --git a/src

Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables

2017-06-05 Thread Etsuro Fujita
On 2017/06/02 18:10, Etsuro Fujita wrote: On 2017/05/16 21:36, Etsuro Fujita wrote: One approach I came up with to fix this issue is to rewrite the targetList entries of an inherited UPDATE/DELETE properly using rewriteTargetListUD, when generating a plan for each child table

Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables

2017-06-02 Thread Etsuro Fujita
On 2017/05/16 21:36, Etsuro Fujita wrote: One approach I came up with to fix this issue is to rewrite the targetList entries of an inherited UPDATE/DELETE properly using rewriteTargetListUD, when generating a plan for each child table in inheritance_planner. Attached is a WIP patch

  1   2   3   4   5   6   7   8   9   10   >