Re: Remove useless tests about TRUNCATE on foreign table

2022-05-31 Thread Yugo NAGATA
On Tue, 31 May 2022 09:49:40 +0900 Michael Paquier wrote: > On Mon, May 30, 2022 at 05:08:10PM +0900, Michael Paquier wrote: > > Partitions have also some coverage as far as I can see, so I agree > > that it makes little sense to keep the tests you are removing here. > > And done as of 0efa513.

Re: Remove useless tests about TRUNCATE on foreign table

2022-05-30 Thread Michael Paquier
On Mon, May 30, 2022 at 05:08:10PM +0900, Michael Paquier wrote: > Partitions have also some coverage as far as I can see, so I agree > that it makes little sense to keep the tests you are removing here. And done as of 0efa513. -- Michael signature.asc Description: PGP signature

Re: Remove useless tests about TRUNCATE on foreign table

2022-05-30 Thread Michael Paquier
On Fri, May 27, 2022 at 05:25:43PM +0900, Yugo NAGATA wrote: > --- TRUNCATE doesn't work on foreign tables, either directly or recursively > -TRUNCATE ft2; -- ERROR > -ERROR: foreign-data wrapper "dummy" has no handler > -TRUNCATE fd_pt1; -- ERROR > -ERROR: foreign-data wrapper "dummy" has no h

Remove useless tests about TRUNCATE on foreign table

2022-05-27 Thread Yugo NAGATA
Hello, I found that tests for TRUNCATE on foreign tables are left in the foreign_data regression test. Now TRUNCATE on foreign tables are allowed, so I think the tests should be removed. Currently, the results of the test is "ERROR: foreign-data wrapper "dummy" has no handler", but it is just

Re: TRUNCATE on foreign table

2021-04-27 Thread Fujii Masao
On 2021/04/27 15:02, Bharath Rupireddy wrote: On Tue, Apr 27, 2021 at 11:19 AM Fujii Masao wrote: In docs v4 patch, I think we can combine below two lines into a single line: + supported by the foreign data wrapper, see . You mean "supported by the foreign data wrapper "? I was th

Re: TRUNCATE on foreign table

2021-04-26 Thread Bharath Rupireddy
On Tue, Apr 27, 2021 at 11:19 AM Fujii Masao wrote: > > In docs v4 patch, I think we can combine below two lines into a single line: > > + supported by the foreign data wrapper, > > see . > > You mean "supported by the foreign data wrapper linkend="postgres-fdw"/>"? > > I was thinking that

Re: TRUNCATE on foreign table

2021-04-26 Thread Fujii Masao
On 2021/04/26 13:52, Bharath Rupireddy wrote: On Fri, Apr 23, 2021 at 9:50 PM Fujii Masao wrote: Thanks for the review! I fixed this. Thanks for the updated patches. In docs v4 patch, I think we can combine below two lines into a single line: + supported by the foreign data wrapper,

Re: TRUNCATE on foreign table

2021-04-25 Thread Bharath Rupireddy
On Fri, Apr 23, 2021 at 9:50 PM Fujii Masao wrote: > Thanks for the review! I fixed this. Thanks for the updated patches. In docs v4 patch, I think we can combine below two lines into a single line: + supported by the foreign data wrapper, see . Other than the above minor change, both pat

Re: TRUNCATE on foreign table

2021-04-23 Thread Fujii Masao
On 2021/04/23 19:56, Bharath Rupireddy wrote: On Fri, Apr 23, 2021 at 1:39 PM Fujii Masao wrote: + + Note that information about ONLY options specified + in the original TRUNCATE command is not passed to I think it is not "information about", no? We just don't pass ONLY option i

Re: TRUNCATE on foreign table

2021-04-23 Thread Bharath Rupireddy
On Fri, Apr 23, 2021 at 1:39 PM Fujii Masao wrote: > > + > > + Note that information about ONLY options specified > > + in the original TRUNCATE command is not passed to > > > > I think it is not "information about", no? We just don't pass ONLY > > option instead we skip it. IMO, we c

Re: TRUNCATE on foreign table

2021-04-23 Thread Fujii Masao
On 2021/04/22 20:27, Bharath Rupireddy wrote: On Thu, Apr 22, 2021 at 12:06 PM Fujii Masao wrote: On 2021/04/22 9:39, Bharath Rupireddy wrote: One comment on truncate_foreign_table_docs_v1.patch: 1) I think it is "to be truncated" + rels is a list of Relation + data structures for ea

Re: TRUNCATE on foreign table

2021-04-23 Thread Fujii Masao
On 2021/04/22 17:56, Justin Pryzby wrote: On Thu, Apr 22, 2021 at 03:36:25PM +0900, Fujii Masao wrote: diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml index 553524553b..69aa66e73e 100644 --- a/doc/src/sgml/fdwhandler.sgml +++ b/doc/src/sgml/fdwhandler.sgml @@ -1076,27

Re: TRUNCATE on foreign table

2021-04-22 Thread Justin Pryzby
On Thu, Apr 22, 2021 at 07:41:06AM -0700, Zhihong Yu wrote: > > > > + Note that ONLY option specified in > > > > > > add "the" to say: "the ONLY" > > > > +1. > > Since 'the only option' is legitimate English phrase, I think the following > would be clearer: > > Note that the option ONLY ... I t

Re: TRUNCATE on foreign table

2021-04-22 Thread Zhihong Yu
On Thu, Apr 22, 2021 at 4:39 AM Bharath Rupireddy < bharath.rupireddyforpostg...@gmail.com> wrote: > On Thu, Apr 22, 2021 at 2:26 PM Justin Pryzby > wrote: > > > > On Thu, Apr 22, 2021 at 03:36:25PM +0900, Fujii Masao wrote: > > > diff --git a/doc/src/sgml/fdwhandler.sgml > b/doc/src/sgml/fdwhand

Re: TRUNCATE on foreign table

2021-04-22 Thread Justin Pryzby
On Thu, Apr 22, 2021 at 05:09:02PM +0530, Bharath Rupireddy wrote: > > should it say "specified" instead of requested ? > > Or should it say "requested the RESTART IDENTITY behavior" ? > > > > Also, I think it should say "..otherwise, the CONTINUE IDENTITY behavior was > > requested". > > The orig

Re: TRUNCATE on foreign table

2021-04-22 Thread Bharath Rupireddy
On Thu, Apr 22, 2021 at 2:26 PM Justin Pryzby wrote: > > On Thu, Apr 22, 2021 at 03:36:25PM +0900, Fujii Masao wrote: > > diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml > > index 553524553b..69aa66e73e 100644 > > --- a/doc/src/sgml/fdwhandler.sgml > > +++ b/doc/src/sgml/f

Re: TRUNCATE on foreign table

2021-04-22 Thread Bharath Rupireddy
On Thu, Apr 22, 2021 at 12:06 PM Fujii Masao wrote: > On 2021/04/22 9:39, Bharath Rupireddy wrote: > > One comment on truncate_foreign_table_docs_v1.patch: > > 1) I think it is "to be truncated" > > + rels is a list of Relation > > + data structures for each foreign table to truncated. > >

Re: TRUNCATE on foreign table

2021-04-22 Thread Justin Pryzby
On Thu, Apr 22, 2021 at 03:36:25PM +0900, Fujii Masao wrote: > diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml > index 553524553b..69aa66e73e 100644 > --- a/doc/src/sgml/fdwhandler.sgml > +++ b/doc/src/sgml/fdwhandler.sgml > @@ -1076,27 +1076,25 @@ ExecForeignTruncate(List

Re: TRUNCATE on foreign table

2021-04-21 Thread Fujii Masao
On 2021/04/22 9:39, Bharath Rupireddy wrote: One comment on truncate_foreign_table_docs_v1.patch: 1) I think it is "to be truncated" + rels is a list of Relation + data structures for each foreign table to truncated. Fixed. Thanks! How about a slightly changed phrasing like below? +

Re: TRUNCATE on foreign table

2021-04-21 Thread Bharath Rupireddy
On Wed, Apr 21, 2021 at 8:31 PM Fujii Masao wrote: > Applied. Attached is the updated version of the patch > (truncate_foreign_table_dont_pass_only_clause_v2.patch). > This patch includes the patch that Horiguchi-san posted upthead. > I'm thinking to commit this patch at first. +1. > > 2) Instea

Re: TRUNCATE on foreign table

2021-04-21 Thread Fujii Masao
On 2021/04/16 15:13, Bharath Rupireddy wrote: On Fri, Apr 16, 2021 at 8:24 AM Fujii Masao wrote: We are still discussing whether RESTRICT option should be pushed down to a foreign data wrapper. But ISTM at least we could reach the consensus about the drop of extra information for each foreign

Re: TRUNCATE on foreign table

2021-04-21 Thread Fujii Masao
On 2021/04/16 14:20, Kyotaro Horiguchi wrote: At Fri, 16 Apr 2021 11:54:16 +0900, Fujii Masao wrote in On 2021/04/16 9:15, Bharath Rupireddy wrote: On Thu, Apr 15, 2021 at 8:19 PM Fujii Masao wrote: On 2021/04/14 12:54, Bharath Rupireddy wrote: IMHO, we can push all the TRUNCATE options

Re: TRUNCATE on foreign table

2021-04-15 Thread Bharath Rupireddy
On Fri, Apr 16, 2021 at 8:24 AM Fujii Masao wrote: > We are still discussing whether RESTRICT option should be pushed down to > a foreign data wrapper. But ISTM at least we could reach the consensus about > the drop of extra information for each foreign table. So what about applying > the attached

Re: TRUNCATE on foreign table

2021-04-15 Thread Kyotaro Horiguchi
At Fri, 16 Apr 2021 11:54:16 +0900, Fujii Masao wrote in > On 2021/04/16 9:15, Bharath Rupireddy wrote: > > On Thu, Apr 15, 2021 at 8:19 PM Fujii Masao > > wrote: > >> On 2021/04/14 12:54, Bharath Rupireddy wrote: > >>> IMHO, we can push all the TRUNCATE options (ONLY, RESTRICTED, CASCADE, > >>

Re: TRUNCATE on foreign table

2021-04-15 Thread Fujii Masao
On 2021/04/16 9:15, Bharath Rupireddy wrote: On Thu, Apr 15, 2021 at 8:19 PM Fujii Masao wrote: On 2021/04/14 12:54, Bharath Rupireddy wrote: IMHO, we can push all the TRUNCATE options (ONLY, RESTRICTED, CASCADE, RESTART/CONTINUE IDENTITY), because it doesn't have any major challenge(impleme

Re: TRUNCATE on foreign table

2021-04-15 Thread Bharath Rupireddy
On Thu, Apr 15, 2021 at 8:19 PM Fujii Masao wrote: > On 2021/04/14 12:54, Bharath Rupireddy wrote: > > IMHO, we can push all the TRUNCATE options (ONLY, RESTRICTED, CASCADE, > > RESTART/CONTINUE IDENTITY), because it doesn't have any major > > challenge(implementation wise) unlike pushing some cla

Re: TRUNCATE on foreign table

2021-04-15 Thread Fujii Masao
On 2021/04/14 13:41, Kyotaro Horiguchi wrote: At Wed, 14 Apr 2021 13:17:55 +0900, Kohei KaiGai wrote in Please assume the internal heap data is managed by PostgreSQL core, and external data source is managed by postgres_fdw (or other FDW driver). TRUNCATE command requires these object manage

Re: TRUNCATE on foreign table

2021-04-15 Thread Fujii Masao
On 2021/04/14 12:54, Bharath Rupireddy wrote: IMHO, we can push all the TRUNCATE options (ONLY, RESTRICTED, CASCADE, RESTART/CONTINUE IDENTITY), because it doesn't have any major challenge(implementation wise) unlike pushing some clauses in SELECT/UPDATE/DELETE and we already do this on the ma

Re: TRUNCATE on foreign table

2021-04-13 Thread Kyotaro Horiguchi
At Wed, 14 Apr 2021 13:17:55 +0900, Kohei KaiGai wrote in > 2021年4月14日(水) 0:00 Fujii Masao : > > > > On 2021/04/13 23:25, Kohei KaiGai wrote: > > > 2021年4月13日(火) 21:03 Bharath Rupireddy > > > : > > >> Yeah, ONLY clause is not pushed to the remote server in case of SELECT > > >> commands. This is

Re: TRUNCATE on foreign table

2021-04-13 Thread Kohei KaiGai
2021年4月14日(水) 0:00 Fujii Masao : > > On 2021/04/13 23:25, Kohei KaiGai wrote: > > 2021年4月13日(火) 21:03 Bharath Rupireddy > > : > >> Yeah, ONLY clause is not pushed to the remote server in case of SELECT > >> commands. This is also true for DELETE and UPDATE commands on foreign > >> tables. > > This

Re: TRUNCATE on foreign table

2021-04-13 Thread Bharath Rupireddy
On Tue, Apr 13, 2021 at 8:30 PM Fujii Masao wrote: > On 2021/04/13 23:25, Kohei KaiGai wrote: > > 2021年4月13日(火) 21:03 Bharath Rupireddy > > : > >> Yeah, ONLY clause is not pushed to the remote server in case of SELECT > >> commands. This is also true for DELETE and UPDATE commands on foreign > >>

Re: TRUNCATE on foreign table

2021-04-13 Thread Fujii Masao
On 2021/04/13 23:25, Kohei KaiGai wrote: 2021年4月13日(火) 21:03 Bharath Rupireddy : Yeah, ONLY clause is not pushed to the remote server in case of SELECT commands. This is also true for DELETE and UPDATE commands on foreign tables. This sounds reasonable reason why ONLY should be ignored in T

Re: TRUNCATE on foreign table

2021-04-13 Thread Kohei KaiGai
2021年4月13日(火) 21:03 Bharath Rupireddy : > > On Tue, Apr 13, 2021 at 2:37 PM Kohei KaiGai wrote: > > Here are two points to discuss. > > > > Regarding to the FDW-APIs, yes, nobody can deny someone want to implement > > their own FDW module that adds special handling when its foreign table > > is sp

Re: TRUNCATE on foreign table

2021-04-13 Thread Bharath Rupireddy
On Tue, Apr 13, 2021 at 2:37 PM Kohei KaiGai wrote: > Here are two points to discuss. > > Regarding to the FDW-APIs, yes, nobody can deny someone want to implement > their own FDW module that adds special handling when its foreign table > is specified > with ONLY-clause, even if we usually ignore.

Re: TRUNCATE on foreign table

2021-04-13 Thread Kohei KaiGai
2021年4月13日(火) 16:17 Fujii Masao : > > On 2021/04/13 14:22, Kohei KaiGai wrote: > > Let me remind the discussion at the design level. > > > > If postgres_fdw (and other FDW drivers) needs to consider whether > > ONLY-clause is given > > on the foreign tables of them, what does a foreign table repres

Re: TRUNCATE on foreign table

2021-04-13 Thread Kyotaro Horiguchi
At Tue, 13 Apr 2021 16:17:12 +0900, Fujii Masao wrote in > > > On 2021/04/13 14:22, Kohei KaiGai wrote: > > Let me remind the discussion at the design level. > > If postgres_fdw (and other FDW drivers) needs to consider whether > > ONLY-clause is given > > on the foreign tables of them, what d

Re: TRUNCATE on foreign table

2021-04-13 Thread Fujii Masao
On 2021/04/13 14:22, Kohei KaiGai wrote: Let me remind the discussion at the design level. If postgres_fdw (and other FDW drivers) needs to consider whether ONLY-clause is given on the foreign tables of them, what does a foreign table represent in PostgreSQL system? My assumption is, a forei

Re: TRUNCATE on foreign table

2021-04-12 Thread Fujii Masao
On 2021/04/13 12:46, Justin Pryzby wrote: On Tue, Apr 13, 2021 at 12:38:35PM +0900, Fujii Masao wrote: + Relation data structures for each + foreign tables to be truncated. "foreign tables" should be "foreign table" because it follows "each"? Yes, you're right. + + behavi

Re: TRUNCATE on foreign table

2021-04-12 Thread Kohei KaiGai
2021年4月9日(金) 23:49 Kohei KaiGai : > > 2021年4月9日(金) 22:51 Fujii Masao : > > > > On 2021/04/09 12:33, Kohei KaiGai wrote: > > > 2021年4月8日(木) 22:14 Fujii Masao : > > >> > > >> On 2021/04/08 22:02, Kohei KaiGai wrote: > > Anyway, attached is the updated version of the patch. This is still > > >>>

Re: TRUNCATE on foreign table

2021-04-12 Thread Justin Pryzby
On Tue, Apr 13, 2021 at 12:38:35PM +0900, Fujii Masao wrote: > + Relation data structures for each > + foreign tables to be truncated. > > "foreign tables" should be "foreign table" because it follows "each"? Yes, you're right. > + > + behavior is either > + DROP_RESTRICT or

Re: TRUNCATE on foreign table

2021-04-12 Thread Fujii Masao
On 2021/04/13 10:21, Bharath Rupireddy wrote: I agree to convert to bits and pass it as int value which is extensible i.e. we can pass more extra parameters across if required. Looks good to me. Also I'm not in favour of removing relids_extra altogether, we might need this to send some in

Re: TRUNCATE on foreign table

2021-04-12 Thread Bharath Rupireddy
On Tue, Apr 13, 2021 at 6:27 AM Justin Pryzby wrote: > > On Sun, Apr 11, 2021 at 03:45:36PM +0530, Bharath Rupireddy wrote: > > On Sun, Apr 11, 2021 at 9:47 AM Justin Pryzby wrote: > > > Also, you currently test: > > > > + if (extra & TRUNCATE_REL_CONTEXT_ONLY) > > > > > > but TRUNCAT

Re: TRUNCATE on foreign table

2021-04-12 Thread Justin Pryzby
On Sun, Apr 11, 2021 at 03:45:36PM +0530, Bharath Rupireddy wrote: > On Sun, Apr 11, 2021 at 9:47 AM Justin Pryzby wrote: > > Also, you currently test: > > > + if (extra & TRUNCATE_REL_CONTEXT_ONLY) > > > > but TRUNCATE_REL_ aren't indepedent bits, so shouldn't be tested with "&". > >

Re: TRUNCATE on foreign table

2021-04-12 Thread Fujii Masao
On 2021/04/09 23:10, Bharath Rupireddy wrote: On Fri, Apr 9, 2021 at 7:06 PM Fujii Masao wrote: > 4. Tab-completion for TRUNCATE should be updated so that also foreign tables are displayed. It will be good to have. Patch attached. Tab completion patch LGTM and it works as ex

Re: TRUNCATE on foreign table

2021-04-12 Thread Fujii Masao
On 2021/04/11 19:15, Bharath Rupireddy wrote: On Sun, Apr 11, 2021 at 9:47 AM Justin Pryzby wrote: Find attached language fixes. Thanks for the patches. Thanks for the patches! 0001 patch basically looks good to me. + behavior must be specified as + DROP_RESTRICT or DROP_CASCAD

Re: TRUNCATE on foreign table

2021-04-11 Thread Bharath Rupireddy
On Sun, Apr 11, 2021 at 9:47 AM Justin Pryzby wrote: > Find attached language fixes. Thanks for the patches. > I'm also proposing to convert an if/else to an switch(), since I don't like > "if/else if" without an "else", and since the compiler can warn about missing > enum values in switch cases

Re: TRUNCATE on foreign table

2021-04-10 Thread Justin Pryzby
On Thu, Apr 08, 2021 at 10:14:17PM +0900, Fujii Masao wrote: > On 2021/04/08 22:02, Kohei KaiGai wrote: > > > Anyway, attached is the updated version of the patch. This is still based > > > on the latest Kazutaka-san's patch. That is, extra list for ONLY is still > > > passed to FDW. What about c

Re: TRUNCATE on foreign table

2021-04-09 Thread Kohei KaiGai
2021年4月9日(金) 22:51 Fujii Masao : > > On 2021/04/09 12:33, Kohei KaiGai wrote: > > 2021年4月8日(木) 22:14 Fujii Masao : > >> > >> On 2021/04/08 22:02, Kohei KaiGai wrote: > Anyway, attached is the updated version of the patch. This is still > based on the latest Kazutaka-san's patch. That is,

Re: TRUNCATE on foreign table

2021-04-09 Thread Bharath Rupireddy
On Fri, Apr 9, 2021 at 7:06 PM Fujii Masao wrote: > > > 2. Currently when the same foreign table is specified multiple times > > in the command, the extra information only for the foreign table found > > first is collected. For example, when "TRUNCATE ft, ONLY ft" is executed, > > TRUNCATE

Re: TRUNCATE on foreign table

2021-04-09 Thread Bharath Rupireddy
On Fri, Apr 9, 2021 at 7:06 PM Fujii Masao wrote: > > > 4. Tab-completion for TRUNCATE should be updated so that also > > foreign tables are displayed. > > > > It will be good to have. > > Patch attached. Tab completion patch LGTM and it works as expected. With Regards, Bharath Rupired

Re: TRUNCATE on foreign table

2021-04-09 Thread Fujii Masao
On 2021/04/09 12:33, Kohei KaiGai wrote: 2021年4月8日(木) 22:14 Fujii Masao : On 2021/04/08 22:02, Kohei KaiGai wrote: Anyway, attached is the updated version of the patch. This is still based on the latest Kazutaka-san's patch. That is, extra list for ONLY is still passed to FDW. What about

Re: TRUNCATE on foreign table

2021-04-09 Thread Fujii Masao
On 2021/04/09 11:05, Zhihong Yu wrote: On Thu, Apr 8, 2021 at 6:47 PM Bharath Rupireddy mailto:bharath.rupireddyforpostg...@gmail.com>> wrote: On Thu, Apr 8, 2021 at 6:44 PM Fujii Masao mailto:masao.fu...@oss.nttdata.com>> wrote: > The followings are the open items and discussion po

Re: TRUNCATE on foreign table

2021-04-08 Thread Kohei KaiGai
2021年4月8日(木) 22:14 Fujii Masao : > > On 2021/04/08 22:02, Kohei KaiGai wrote: > >> Anyway, attached is the updated version of the patch. This is still based > >> on the latest Kazutaka-san's patch. That is, extra list for ONLY is still > >> passed to FDW. What about committing this version at fir

Re: TRUNCATE on foreign table

2021-04-08 Thread Zhihong Yu
On Thu, Apr 8, 2021 at 6:47 PM Bharath Rupireddy < bharath.rupireddyforpostg...@gmail.com> wrote: > On Thu, Apr 8, 2021 at 6:44 PM Fujii Masao > wrote: > > The followings are the open items and discussion points that I'm > thinking of. > > > > 1. Currently the extra information (TRUNCATE_REL_CONT

Re: TRUNCATE on foreign table

2021-04-08 Thread Bharath Rupireddy
On Thu, Apr 8, 2021 at 6:44 PM Fujii Masao wrote: > The followings are the open items and discussion points that I'm thinking of. > > 1. Currently the extra information (TRUNCATE_REL_CONTEXT_NORMAL, > TRUNCATE_REL_CONTEXT_ONLY or TRUNCATE_REL_CONTEXT_CASCADING) about how a > foreign table was sp

Re: TRUNCATE on foreign table

2021-04-08 Thread Kazutaka Onishi
Fujii-san, > >> Anyway, attached is the updated version of the patch. This is still based > >> on the latest Kazutaka-san's patch. That is, extra list for ONLY is still > >> passed to FDW. What about committing this version at first? Then we can > >> continue the discussion and change the behav

Re: TRUNCATE on foreign table

2021-04-08 Thread Fujii Masao
On 2021/04/08 22:02, Kohei KaiGai wrote: Anyway, attached is the updated version of the patch. This is still based on the latest Kazutaka-san's patch. That is, extra list for ONLY is still passed to FDW. What about committing this version at first? Then we can continue the discussion and cha

Re: TRUNCATE on foreign table

2021-04-08 Thread Kohei KaiGai
2021年4月8日(木) 18:25 Fujii Masao : > > On 2021/04/08 15:48, Kohei KaiGai wrote: > > 2021年4月8日(木) 15:04 Fujii Masao : > >> > >> On 2021/04/08 13:43, Kohei KaiGai wrote: > >>> In case when a local table (with no children) has same contents, > >>> TRUNCATE command > >>> witll remove the entire table con

Re: TRUNCATE on foreign table

2021-04-08 Thread Fujii Masao
On 2021/04/08 18:25, Fujii Masao wrote: Anyway, attached is the updated version of the patch. This is still based on the latest Kazutaka-san's patch. That is, extra list for ONLY is still passed to FDW. What about committing this version at first? Then we can continue the discussion and chan

Re: TRUNCATE on foreign table

2021-04-08 Thread Fujii Masao
On 2021/04/08 15:48, Kohei KaiGai wrote: 2021年4月8日(木) 15:04 Fujii Masao : On 2021/04/08 13:43, Kohei KaiGai wrote: In case when a local table (with no children) has same contents, TRUNCATE command witll remove the entire table contents. But if there are local child tables that inherit the

Re: TRUNCATE on foreign table

2021-04-07 Thread Kohei KaiGai
2021年4月8日(木) 15:04 Fujii Masao : > > On 2021/04/08 13:43, Kohei KaiGai wrote: > > In case when a local table (with no children) has same contents, > > TRUNCATE command > > witll remove the entire table contents. > > But if there are local child tables that inherit the local parent table, and > TRU

Re: TRUNCATE on foreign table

2021-04-07 Thread Fujii Masao
On 2021/04/08 13:43, Kohei KaiGai wrote: In case when a local table (with no children) has same contents, TRUNCATE command witll remove the entire table contents. But if there are local child tables that inherit the local parent table, and TRUNCATE ONLY is executed, only the contents in th

Re: TRUNCATE on foreign table

2021-04-07 Thread Kohei KaiGai
2021年4月8日(木) 11:44 Fujii Masao : > > On 2021/04/08 10:56, Kohei KaiGai wrote: > > 2021年4月8日(木) 4:19 Fujii Masao : > >> > >> On 2021/04/06 21:06, Kazutaka Onishi wrote: > >>> Thank you for checking v13, and here is v14 patch. > >>> > 1) Are we using all of these macros? I see that we are settin

Re: TRUNCATE on foreign table

2021-04-07 Thread Fujii Masao
On 2021/04/08 10:56, Kohei KaiGai wrote: 2021年4月8日(木) 4:19 Fujii Masao : On 2021/04/06 21:06, Kazutaka Onishi wrote: Thank you for checking v13, and here is v14 patch. 1) Are we using all of these macros? I see that we are setting them but we only use TRUNCATE_REL_CONTEXT_ONLY. If not use

Re: TRUNCATE on foreign table

2021-04-07 Thread Kohei KaiGai
2021年4月8日(木) 4:19 Fujii Masao : > > On 2021/04/06 21:06, Kazutaka Onishi wrote: > > Thank you for checking v13, and here is v14 patch. > > > >> 1) Are we using all of these macros? I see that we are setting them > >> but we only use TRUNCATE_REL_CONTEXT_ONLY. If not used, can we remove > >> them? >

Re: TRUNCATE on foreign table

2021-04-07 Thread Fujii Masao
On 2021/04/06 21:06, Kazutaka Onishi wrote: Thank you for checking v13, and here is v14 patch. 1) Are we using all of these macros? I see that we are setting them but we only use TRUNCATE_REL_CONTEXT_ONLY. If not used, can we remove them? These may be needed for the foreign data handler ot

Re: TRUNCATE on foreign table

2021-04-06 Thread Kazutaka Onishi
> One minor thing - I think "mixtured" is not the > correct word in "+-- partition table mixtured by table and foreign > table". How about something like "+-- partitioned table with both > local and foreign table as partitions"? Sure. I've fixed this. > The v15 patch basically looks good to me. I

Re: TRUNCATE on foreign table

2021-04-06 Thread Bharath Rupireddy
On Tue, Apr 6, 2021 at 10:15 PM Kazutaka Onishi wrote: > I've checked v15 patch with "make check-world" and confirmed this passed. Thanks for the patch. One minor thing - I think "mixtured" is not the correct word in "+-- partition table mixtured by table and foreign table". How about something l

Re: TRUNCATE on foreign table

2021-04-06 Thread Kazutaka Onishi
I've attached v15. > I still feel that the above bunch of code is duplicate of what > do_sql_command function already has. I would recommend that we just > make that function non-static(it's easy to do) and keep the > declaration in postgres_fdw.h and use it in the > postgresExecForeignTruncate.

Re: TRUNCATE on foreign table

2021-04-06 Thread Bharath Rupireddy
On Tue, Apr 6, 2021 at 5:36 PM Kazutaka Onishi wrote: > > Thank you for checking v13, and here is v14 patch. cfbot failure on v14 - https://cirrus-ci.com/task/4772360931770368. Looks like it is not related to this patch, please re-confirm it. With Regards, Bharath Rupireddy. EnterpriseDB: http:/

Re: TRUNCATE on foreign table

2021-04-06 Thread Bharath Rupireddy
On Tue, Apr 6, 2021 at 5:36 PM Kazutaka Onishi wrote: > > Thank you for checking v13, and here is v14 patch. > > > 1) Are we using all of these macros? I see that we are setting them > > but we only use TRUNCATE_REL_CONTEXT_ONLY. If not used, can we remove > > them? > > These may be needed for the

Re: TRUNCATE on foreign table

2021-04-06 Thread Kazutaka Onishi
Thank you for checking v13, and here is v14 patch. > 1) Are we using all of these macros? I see that we are setting them > but we only use TRUNCATE_REL_CONTEXT_ONLY. If not used, can we remove > them? These may be needed for the foreign data handler other than postgres_fdw. > 2) Why is this chan

Re: TRUNCATE on foreign table

2021-04-05 Thread Bharath Rupireddy
On Mon, Apr 5, 2021 at 8:47 PM Kazutaka Onishi wrote: > > > Did you check that hash_destroy is not reachable when an error occurs > > on the remote server while executing truncate command? > > I've checked it and hash_destroy doesn't work on error. > > I just adding elog() to check this: > + elog(

Re: TRUNCATE on foreign table

2021-04-05 Thread Kazutaka Onishi
> Did you check that hash_destroy is not reachable when an error occurs > on the remote server while executing truncate command? I've checked it and hash_destroy doesn't work on error. I just adding elog() to check this: + elog(NOTICE,"destroyed"); + hash_destroy(ft_htab); Then I've checked by t

Re: TRUNCATE on foreign table

2021-04-05 Thread Bharath Rupireddy
On Mon, Apr 5, 2021 at 7:38 PM Kazutaka Onishi wrote: > > 3) I think we need truncatable behaviour that is consistent with updatable. > > It's not correct. "truncatable" option works the same as "updatable". > I've confirmed that the table can be truncated with the combination: > truncatable on th

Re: TRUNCATE on foreign table

2021-04-05 Thread Kazutaka Onishi
Thank you for your comments. I've attached v13. > Here are some more comments on the v12 patch: > I still don't understand why we need sum(id), not count(*). Am I > missing something here? The value of "id" is used for checking whether correct records are truncated or not. For instance, on "trunc

Re: TRUNCATE on foreign table

2021-04-04 Thread Bharath Rupireddy
On Sun, Apr 4, 2021 at 10:23 PM Kazutaka Onishi wrote: > Sure. I've replaced with the test command "SELECT * FROM ..." to > "SELECT COUNT(*) FROM ..." > However, for example, the "id" column is used to check after running > TRUNCATE with ONLY clause to the inherited table. > Thus, I use "sum(id)"

Re: TRUNCATE on foreign table

2021-04-04 Thread Kazutaka Onishi
Thank you for checking v11! I've updated it and attached v12. > I usually follow these steps: > 1) write code 2) git diff --check (will give if there are any white > space or indentation errors) 3) git add -u 4) git commit (will enter a > commit message) 5) git format-patch -1 <> -v > <> 6) to app

Re: TRUNCATE on foreign table

2021-04-04 Thread Bharath Rupireddy
On Sun, Apr 4, 2021 at 12:00 PM Kazutaka Onishi wrote: > > 5) Can't we use do_sql_command function after making it non static? We > > could go extra mile, that is we could make do_sql_command little more > > generic by passing some enum for each of PQsendQuery, > > PQsendQueryParams, PQsendQueryPr

Re: TRUNCATE on foreign table

2021-04-04 Thread Kazutaka Onishi
Oops... sorry. I haven't merged my working git branch with remote master branch. Please check this v11. 2021年4月4日(日) 23:56 Bharath Rupireddy : > > On Sun, Apr 4, 2021 at 12:48 PM Kazutaka Onishi wrote: > > > > v9 has also typo because I haven't checked about doc... sorry. > > I think v9 has some

Re: TRUNCATE on foreign table

2021-04-04 Thread Bharath Rupireddy
On Sun, Apr 4, 2021 at 12:48 PM Kazutaka Onishi wrote: > > v9 has also typo because I haven't checked about doc... sorry. I think v9 has some changes not related to the foreign table truncate feature. If yes, please remove those changes and provide a proper patch. diff --git a/doc/src/sgml/ref/p

Re: TRUNCATE on foreign table

2021-04-03 Thread Kohei KaiGai
2021年4月4日(日) 13:07 Bharath Rupireddy : > > On Sat, Apr 3, 2021 at 8:31 PM Zhihong Yu wrote: > > w.r.t. Bharath's question on using hash table, I think the reason is that > > the search would be more efficient: > > Generally, sequential search would be slower if there are many entries > in a list.

Re: TRUNCATE on foreign table

2021-04-03 Thread Bharath Rupireddy
On Sat, Apr 3, 2021 at 8:31 PM Zhihong Yu wrote: > w.r.t. Bharath's question on using hash table, I think the reason is that the > search would be more efficient: Generally, sequential search would be slower if there are many entries in a list. Here, the use case is to store all the foreign tabl

Re: TRUNCATE on foreign table

2021-04-03 Thread Zhihong Yu
Continuing previous review... + relids_extra = lappend_int(relids_extra, TRUNCATE_REL_CONTEXT__CASCADED); I wonder if TRUNCATE_REL_CONTEXT_CASCADING is better than TRUNCATE_REL_CONTEXT__CASCADED. Note the removal of the extra underscore. In English, we say: truncation cascading to f

Re: TRUNCATE on foreign table

2021-04-03 Thread Zhihong Yu
Hi, + TRUNCATE for each foreign server being involved + in one TRUNCATE command (note that invocations The 'being' in above sentence can be omitted. + the context where the foreign-tables are truncated. It is a list of integers and same length with There should be a verb between 'and

Re: TRUNCATE on foreign table

2021-04-03 Thread Bharath Rupireddy
On Sat, Apr 3, 2021 at 7:16 PM Kazutaka Onishi wrote: > > Sorry but I found the v7 patch has typo and it can't be built... > I attached fixed one(v8). Thanks for the patch. Here are some comments on v8 patch: 1) We usually have the struct name after "+typedef struct ForeignTruncateInfo", please r

Re: TRUNCATE on foreign table

2021-04-03 Thread Kazutaka Onishi
Sorry but I found the v7 patch has typo and it can't be built... I attached fixed one(v8). 2021年4月3日(土) 9:53 Kazutaka Onishi : > > All, > > Thank you for discussion. > I've updated the patch (v6->v7) according to the conclusion. > > I'll show the modified points: > 1. Comments for ExecuteTuncate()

Re: TRUNCATE on foreign table

2021-04-02 Thread Kazutaka Onishi
All, Thank you for discussion. I've updated the patch (v6->v7) according to the conclusion. I'll show the modified points: 1. Comments for ExecuteTuncate() 2. Replacing extra value in frels_extra with integer to label. 3. Skipping XLOG_HEAP_TRUNCATE on foreign table Regards, 2021年4月2日(金) 11:44

Re: TRUNCATE on foreign table

2021-04-01 Thread Fujii Masao
On 2021/04/02 9:37, Kohei KaiGai wrote: It is fair enough for me to reverse the order of actual truncation. How about the updated comments below? This is a multi-relation truncate. We first open and grab exclusive lock on all relations involved, checking permissions (local databas

Re: TRUNCATE on foreign table

2021-04-01 Thread Kohei KaiGai
2021年4月1日(木) 18:53 Fujii Masao : > > On 2021/04/01 0:09, Kohei KaiGai wrote: > > What does the "permission checks" mean in this context? > > The permission checks on the foreign tables involved are already checked > > at truncate_check_rel(), by PostgreSQL's standard access control. > > I meant tha

Re: TRUNCATE on foreign table

2021-04-01 Thread Fujii Masao
On 2021/04/01 0:09, Kohei KaiGai wrote: What does the "permission checks" mean in this context? The permission checks on the foreign tables involved are already checked at truncate_check_rel(), by PostgreSQL's standard access control. I meant that's the permission check that happens in the r

Re: TRUNCATE on foreign table

2021-03-31 Thread Kohei KaiGai
2021年3月30日(火) 2:53 Fujii Masao : > > On 2021/03/28 2:37, Kazutaka Onishi wrote: > > Fujii-san, > > > > Thank you for your review! > > Now I prepare v5 patch and I'll answer to your each comment. please > > check this again. > > Thanks a lot! > > > 5. For example, we can easily do that by truncate f

Re: TRUNCATE on foreign table

2021-03-29 Thread Fujii Masao
On 2021/03/30 10:11, Kohei KaiGai wrote: 2021年3月30日(火) 3:45 Fujii Masao : On 2021/03/28 2:37, Kazutaka Onishi wrote: Fujii-san, Thank you for your review! Now I prepare v5 patch and I'll answer to your each comment. please check this again. m(_ _)m 1. In postgres-fdw.sgml, "and truncatabl

Re: TRUNCATE on foreign table

2021-03-29 Thread Kohei KaiGai
2021年3月30日(火) 3:45 Fujii Masao : > > On 2021/03/28 2:37, Kazutaka Onishi wrote: > > Fujii-san, > > > > Thank you for your review! > > Now I prepare v5 patch and I'll answer to your each comment. please > > check this again. > > m(_ _)m > > > > 1. In postgres-fdw.sgml, "and truncatable" should be ap

Re: TRUNCATE on foreign table

2021-03-29 Thread Kohei KaiGai
2021年3月30日(火) 2:54 Fujii Masao : > > On 2021/03/29 13:55, Michael Paquier wrote: > > On Mon, Mar 29, 2021 at 10:53:14AM +0900, Fujii Masao wrote: > >> I understand the motivation of this. But the other DMLs like UPDATE also > >> do the same thing for foreign tables? That is, when those DML commands

Re: TRUNCATE on foreign table

2021-03-29 Thread Fujii Masao
On 2021/03/28 2:37, Kazutaka Onishi wrote: Fujii-san, Thank you for your review! Now I prepare v5 patch and I'll answer to your each comment. please check this again. m(_ _)m 1. In postgres-fdw.sgml, "and truncatable" should be appended into the above first description? 2. truncate.sgml shou

Re: TRUNCATE on foreign table

2021-03-29 Thread Fujii Masao
On 2021/03/29 13:55, Michael Paquier wrote: On Mon, Mar 29, 2021 at 10:53:14AM +0900, Fujii Masao wrote: I understand the motivation of this. But the other DMLs like UPDATE also do the same thing for foreign tables? That is, when those DML commands are executed on foreign tables, their change

Re: TRUNCATE on foreign table

2021-03-29 Thread Fujii Masao
On 2021/03/28 2:37, Kazutaka Onishi wrote: Fujii-san, Thank you for your review! Now I prepare v5 patch and I'll answer to your each comment. please check this again. Thanks a lot! 5. For example, we can easily do that by truncate foreign tables before local ones. Thought? Umm... yeah, I

Re: TRUNCATE on foreign table

2021-03-28 Thread Michael Paquier
On Mon, Mar 29, 2021 at 10:53:14AM +0900, Fujii Masao wrote: > I understand the motivation of this. But the other DMLs like UPDATE also > do the same thing for foreign tables? That is, when those DML commands > are executed on foreign tables, their changes are WAL-logged in a publisher > side, > e

Re: TRUNCATE on foreign table

2021-03-28 Thread Fujii Masao
On 2021/03/29 9:31, Kohei KaiGai wrote: Fujii-san, XLOG_HEAP_TRUNCATE record is written even for the truncation of a foreign table. Why is this necessary? Foreign-tables are often used to access local data structure, like columnar data files on filesystem, not only remote accesses like pos

  1   2   >