On Mon, Aug 26, 2024 at 7:28 AM Peter Smith <smithpb2...@gmail.com> wrote: > > On Thu, Aug 22, 2024 at 8:15 PM shveta malik <shveta.ma...@gmail.com> wrote: > > > > Hi Shveta, > > I felt it would be better to keep the syntax similar to the existing > INSERT ... ON CONFLICT [1]. > > I'd suggest a syntax like this: > > ... ON CONFLICT ['conflict_type'] DO { 'conflict_action' | DEFAULT } > > ~~~ > > e.g. > > To configure conflict resolvers for the SUBSCRIPTION: > > CREATE SUBSCRIPTION subname CONNECTION coninfo PUBLICATION pubname > ON CONFLICT 'conflict_type1' DO 'conflict_action1', > ON CONFLICT 'conflict_type2' DO 'conflict_action2'; >
One thing that looks odd to me about this is the resolution part of it. For example, ON CONFLICT 'insert_exists' DO 'keep_local'. The action part doesn't go well without being explicit that it is a resolution method. Another variant could be ON CONFLICT 'insert_exists' USE RESOLUTION [METHOD] 'keep_local'. I think we can keep all these syntax alternatives either in the form of comments or in the commit message and discuss more on these once we agree on the solutions to the key design issues pointed out by Shveta. -- With Regards, Amit Kapila.