Re: TRUNCATE on foreign tables

2020-08-02 Thread Daniel Gustafsson
> On 2 Jul 2020, at 16:40, Daniel Gustafsson wrote: > >> On 1 Mar 2020, at 03:24, Kohei KaiGai wrote: > >> The attached is revised version. > > This version fails to apply to HEAD due to conflicts in postgres_fdw expected > test output. Can you please submit a rebased version. Marking the en

Re: TRUNCATE on foreign tables

2020-07-02 Thread Daniel Gustafsson
> On 1 Mar 2020, at 03:24, Kohei KaiGai wrote: > The attached is revised version. This version fails to apply to HEAD due to conflicts in postgres_fdw expected test output. Can you please submit a rebased version. Marking the entry Waiting on Author in the meantime. cheers ./daniel

Re: TRUNCATE on foreign tables

2020-02-29 Thread Kohei KaiGai
Hello, The attached is revised version. > > If callback is invoked with a foreign-relation that is specified by TRUNCATE > > command with ONLY, it seems to me reasonable that remote TRUNCATE > > command specifies the relation on behalf of the foreign table with ONLY. > > > > So, if ExecForeignTru

Re: TRUNCATE on foreign tables

2020-01-27 Thread Michael Paquier
On Mon, Jan 27, 2020 at 11:08:36PM +0900, Kohei KaiGai wrote: > Hmm. Do we need to deliver another list to inform why these relations are > trundated? I got to think more about this one, and being able to control ONLY on a per-relation basis would be the least surprising approach for the commands

Re: TRUNCATE on foreign tables

2020-01-27 Thread Kohei KaiGai
2020年1月21日(火) 15:38 Michael Paquier : > > On Mon, Jan 20, 2020 at 10:50:21PM +0900, Michael Paquier wrote: > > I have spent a good amount of time polishing 0001, tweaking the docs, > > comments, error messages and a bit its logic. I am getting > > comfortable with it, but it still needs an extra l

Re: TRUNCATE on foreign tables

2020-01-20 Thread Michael Paquier
On Mon, Jan 20, 2020 at 10:50:21PM +0900, Michael Paquier wrote: > I have spent a good amount of time polishing 0001, tweaking the docs, > comments, error messages and a bit its logic. I am getting > comfortable with it, but it still needs an extra lookup, an indent run > which has some noise and

Re: TRUNCATE on foreign tables

2020-01-20 Thread Michael Paquier
On Mon, Jan 20, 2020 at 11:30:34AM +0900, Kohei KaiGai wrote: > Sorry, it was a midnight job on Friday. Should I be, err, worried about that? ;) > Please check the attached patch. + switch (behavior) + { + case DROP_RESTRICT: + appendStringInfoString(buf, " RESTRICT"); +

Re: TRUNCATE on foreign tables

2020-01-19 Thread Kohei KaiGai
2020年1月20日(月) 11:09 Kyotaro Horiguchi : > > Hello. > > At Fri, 17 Jan 2020 22:49:41 +0900, Kohei KaiGai wrote > in > > The v3 patch updated the points below: > > Did you attached it? > Sorry, it was a midnight job on Friday. Please check the attached patch. Best regards, -- HeteroDB, Inc / The

Re: TRUNCATE on foreign tables

2020-01-19 Thread Kyotaro Horiguchi
Hello. At Fri, 17 Jan 2020 22:49:41 +0900, Kohei KaiGai wrote in > The v3 patch updated the points below: Did you attached it? regards. -- Kyotaro Horiguchi NTT Open Source Software Center

Re: TRUNCATE on foreign tables

2020-01-17 Thread Kohei KaiGai
Hi, The v3 patch updated the points below: - 2nd arg of ExecForeignTruncate was changed to DropBehavior, not bool - ExecuteTruncateGuts() uses a local hash table to track a pair of server-id and list of the foreign tables managed by the server. - Error message on truncate_check_rel() was revised

Re: TRUNCATE on foreign tables

2020-01-15 Thread Michael Paquier
On Wed, Jan 15, 2020 at 11:33:07PM +0900, Kohei KaiGai wrote: > 2020年1月15日(水) 17:11 Michael Paquier : >> I have done a quick read through the patch. You have modified the >> patch to pass down to the callback a list of relation OIDs to execute >> one command for all, and there are tests for FKs so

Re: TRUNCATE on foreign tables

2020-01-15 Thread Kohei KaiGai
2020年1月15日(水) 17:11 Michael Paquier : > > On Tue, Jan 14, 2020 at 06:16:17PM +0900, Kohei KaiGai wrote: > > The "frels_list" is a list of foreign tables that are connected to a > > particular > > foreign server, thus, the server-id pulled out by foreign tables id should > > be > > identical for a

Re: TRUNCATE on foreign tables

2020-01-15 Thread Michael Paquier
On Tue, Jan 14, 2020 at 06:16:17PM +0900, Kohei KaiGai wrote: > The "frels_list" is a list of foreign tables that are connected to a > particular > foreign server, thus, the server-id pulled out by foreign tables id should be > identical for all the relations in the list. > Due to the API design,

Re: TRUNCATE on foreign tables

2020-01-14 Thread Kohei KaiGai
Hello, The attached patch is the revised version of TRUNCATE on foreign tables. Definition of the callback is revised as follows: typedef void (*ExecForeignTruncate_function) (List *frels_list, bool is_cascade

Re: TRUNCATE on foreign tables

2020-01-07 Thread Kohei KaiGai
2020年1月7日(火) 16:03 Michael Paquier : > > On Mon, Jan 06, 2020 at 04:32:39PM -0500, Stephen Frost wrote: > > RESTRICT, yes. I don't know about ONLY being sensible as we don't > > really deal with inheritance and foreign tables very cleanly today, as I > > said up-thread, so I'm not sure if we reall

Re: TRUNCATE on foreign tables

2020-01-06 Thread Michael Paquier
On Mon, Jan 06, 2020 at 04:32:39PM -0500, Stephen Frost wrote: > RESTRICT, yes. I don't know about ONLY being sensible as we don't > really deal with inheritance and foreign tables very cleanly today, as I > said up-thread, so I'm not sure if we really want to put in the effort > that it'd require

Re: TRUNCATE on foreign tables

2020-01-06 Thread Stephen Frost
Greetings, * Michael Paquier (mich...@paquier.xyz) wrote: > On Thu, Jan 02, 2020 at 09:46:44AM -0500, Stephen Frost wrote: > > I agree that the FDW callback should support multiple tables in the > > TRUNCATE, but I think it also should include CASCADE as an option and > > have that be passed on to

Re: TRUNCATE on foreign tables

2020-01-05 Thread Michael Paquier
On Thu, Jan 02, 2020 at 09:46:44AM -0500, Stephen Frost wrote: > I agree that the FDW callback should support multiple tables in the > TRUNCATE, but I think it also should include CASCADE as an option and > have that be passed on to the FDW to handle. As much as RESTRICT, ONLY and the INDENTITY cl

Re: TRUNCATE on foreign tables

2020-01-02 Thread Stephen Frost
Greetings, * Kohei KaiGai (kai...@heterodb.com) wrote: > 2020年1月2日(木) 20:56 Alvaro Herrera : > > On 2020-Jan-02, Kohei KaiGai wrote: > > > 2020年1月2日(木) 12:16 Alvaro Herrera : > > > > I think this would need to preserve the notion of multi-table truncates. > > > > Otherwise it won't be possible to

Re: TRUNCATE on foreign tables

2020-01-02 Thread Kohei KaiGai
2020年1月2日(木) 20:56 Alvaro Herrera : > > On 2020-Jan-02, Kohei KaiGai wrote: > > > 2020年1月2日(木) 12:16 Alvaro Herrera : > > > > > > I think this would need to preserve the notion of multi-table truncates. > > > Otherwise it won't be possible to truncate tables linked by FKs. I > > > think this means

Re: TRUNCATE on foreign tables

2020-01-02 Thread Alvaro Herrera
On 2020-Jan-02, Kohei KaiGai wrote: > 2020年1月2日(木) 12:16 Alvaro Herrera : > > > > I think this would need to preserve the notion of multi-table truncates. > > Otherwise it won't be possible to truncate tables linked by FKs. I > > think this means the new entrypoint needs to receive a list of rels

Re: TRUNCATE on foreign tables

2020-01-01 Thread Kohei KaiGai
2020年1月2日(木) 12:16 Alvaro Herrera : > > On 2020-Jan-01, Kohei KaiGai wrote: > > > Hello, > > > > The attached patch adds TRUNCATE support on foreign table. > > > > This patch adds an optional callback ExecForeignTruncate(Relation rel) > > to FdwRoutine. > > It is invoked during ExecuteTruncateGuts,

Re: TRUNCATE on foreign tables

2020-01-01 Thread Alvaro Herrera
On 2020-Jan-01, Kohei KaiGai wrote: > Hello, > > The attached patch adds TRUNCATE support on foreign table. > > This patch adds an optional callback ExecForeignTruncate(Relation rel) > to FdwRoutine. > It is invoked during ExecuteTruncateGuts, then FDW driver hands over > the jobs related to com

Re: TRUNCATE on foreign tables

2019-12-31 Thread Kohei KaiGai
) 11:46 Kohei KaiGai : > > Hello, > > We right now don't support TRUNCATE on foreign tables. > It may be a strange missing piece and restriction of operations. > For example, if a partitioned table contains some foreign tables in its leaf, > user cannot use TRUN

TRUNCATE on foreign tables

2019-12-31 Thread Kohei KaiGai
Hello, We right now don't support TRUNCATE on foreign tables. It may be a strange missing piece and restriction of operations. For example, if a partitioned table contains some foreign tables in its leaf, user cannot use TRUNCATE command to clean up the partitioned table. Probably, API desi