From: | Peter Geoghegan <pg(at)heroku(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | hlinnaka <hlinnaka(at)iki(dot)fi>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
Subject: | Re: INSERT ... ON CONFLICT syntax issues |
Date: | 2015-05-05 21:51:41 |
Message-ID: | CAM3SWZQ6_6OVXUt4uiguSiAV0N4CyCHU6BMosB9GP7XXk3jQPw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, May 5, 2015 at 9:36 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> Theoretically this changes the pictures for FDWs, right? Right now
> there's
> + <para>
> + <command>INSERT</> with an <literal>ON CONFLICT</> clause is not
> + supported with a unique index inference specification, since a
> + conflict arbitrating unique index cannot meaningfully be inferred
> + on a foreign table (this implies that <literal>ON CONFLICT DO
> + UPDATE</> is never supported, since the specification is
> + mandatory there).
> + </para>
> but theoretically the constraint name could be meaningful on the other
> side...
Well, the inference clause could be too -- in that sense, the
constraint name isn't special at all. But you need to invent a way of
making the optimizer infer an index on the foreign side (and even with
a named constraint, we go from constraint Oid in the parser to
pg_index Oid in the optimizer, so it's a similar process to regular
inference). Of course, teaching the optimizer about foreign indexes is
a whole new infrastructure.
Note that this really is the explanation for why postgres_fdw only has
limited support. Sure, I haven't added deparsing logic for ON CONFLICT
UPDATE, but it would be pretty easy to do so, and that isn't the
blocker at all.
> I don't think this is anyting for 9.5, but it might be interesting for
> later.
Sure.
--
Peter Geoghegan
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2015-05-05 22:00:56 | Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0 |
Previous Message | Alvaro Herrera | 2015-05-05 21:22:22 | Re: BRIN range operator class |