Re: Fix error message for MERGE foreign tables

2022-10-16 Thread Richard Guo
On Fri, Oct 14, 2022 at 10:43 PM Tom Lane wrote: > Richard Guo writes: > > Or maybe we can make it even earlier, when we expand an RTE for a > > partitioned table and add result tables to leaf_result_relids. > > I'm not really on board with injecting command-type-specific logic into > completely

Re: Fix error message for MERGE foreign tables

2022-10-14 Thread Tom Lane
Richard Guo writes: > Or maybe we can make it even earlier, when we expand an RTE for a > partitioned table and add result tables to leaf_result_relids. I'm not really on board with injecting command-type-specific logic into completely unrelated places just so that we can throw an error a bit ear

Re: Fix error message for MERGE foreign tables

2022-10-14 Thread Richard Guo
On Fri, Oct 14, 2022 at 7:19 PM Richard Guo wrote: > > On Fri, Oct 14, 2022 at 5:24 PM Alvaro Herrera > wrote: > >> Actually, I hadn't realized that the originally submitted patch had the >> test in postgres_fdw only, but we really want it to catch any FDW, so it >> needs to be somewhere more ge

Re: Fix error message for MERGE foreign tables

2022-10-14 Thread Richard Guo
On Fri, Oct 14, 2022 at 5:24 PM Alvaro Herrera wrote: > Actually, I hadn't realized that the originally submitted patch had the > test in postgres_fdw only, but we really want it to catch any FDW, so it > needs to be somewhere more general. The best place I found to put this > test is in make_mo

Re: Fix error message for MERGE foreign tables

2022-10-14 Thread Alvaro Herrera
Actually, I hadn't realized that the originally submitted patch had the test in postgres_fdw only, but we really want it to catch any FDW, so it needs to be somewhere more general. The best place I found to put this test is in make_modifytable ... I searched for some earlier place in the planner t

Re: Fix error message for MERGE foreign tables

2022-10-14 Thread Alvaro Herrera
On 2022-Oct-14, Michael Paquier wrote: > On Fri, Oct 14, 2022 at 12:26:19PM +0800, Richard Guo wrote: > > Maybe something like below, so that we keep it consistent with the case > > of a foreign table being specified as a target. > > > > --- a/contrib/postgres_fdw/postgres_fdw.c > > +++ b/contrib

Re: Fix error message for MERGE foreign tables

2022-10-14 Thread Michael Paquier
On Fri, Oct 14, 2022 at 12:26:19PM +0800, Richard Guo wrote: > Maybe something like below, so that we keep it consistent with the case > of a foreign table being specified as a target. > > --- a/contrib/postgres_fdw/postgres_fdw.c > +++ b/contrib/postgres_fdw/postgres_fdw.c > @@ -1872,6 +1872,13 @

Re: Fix error message for MERGE foreign tables

2022-10-13 Thread Richard Guo
On Fri, Oct 14, 2022 at 12:07 PM Richard Guo wrote: > > On Fri, Oct 14, 2022 at 10:59 AM bt22nakamorit < > bt22nakamo...@oss.nttdata.com> wrote: > >> Hi, >> >> MERGE command does not accept foreign tables as targets. >> When a foreign table is specified as a target, it shows error messages >> lik

Re: Fix error message for MERGE foreign tables

2022-10-13 Thread Richard Guo
On Fri, Oct 14, 2022 at 10:59 AM bt22nakamorit < bt22nakamo...@oss.nttdata.com> wrote: > Hi, > > MERGE command does not accept foreign tables as targets. > When a foreign table is specified as a target, it shows error messages > like this: > > -- ERROR: cannot execute MERGE on relation "child1" >

Fix error message for MERGE foreign tables

2022-10-13 Thread bt22nakamorit
Hi, MERGE command does not accept foreign tables as targets. When a foreign table is specified as a target, it shows error messages like this: -- ERROR: cannot execute MERGE on relation "child1" -- DETAIL: This operation is not supported for foreign tables. However, when a partitioned table