Re: MERGE SQL Statement for PG11

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: MERGE SQL Statement for PG11
Date: 2017-10-27 12:45:55
Message-ID: 20171027124555.txawx6p6veikx25x@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs wrote:

> Earlier thoughts on how this could/could not be done were sometimes
> imprecise or inaccurate, so I have gone through the command per
> SQL:2011 spec and produced a definitive spec in the form of an SGML
> ref page. This is what I intend to deliver for PG11.

Nice work. I didn't verify the SQL spec, just read your HTML page;
some very minor comments based on that:

* use "and" not "where" as initial words in "when_clause" and
"merge_update" clause definitions

* missing word here: "the DELETE privilege on the if you specify"

* I think the word "match." is leftover from some editing in the phrase
" that specifies which rows in the data_source match rows in the
target_table_name. match." In the same paragraph, it is not clear
whether all columns must be matched or it can be a partial match.

* In the when_clause note, it is not clear whether you can have multiple
WHEN MATCHED and WHEN NOT MATCHED clauses. Obviously you can have one
of each, but I think your doc says it is possible to have more than one of
each, with different conditions (WHEN MATCHED AND foo THEN bar WHEN
MATCHED AND baz THEN qux). No example shows more than one.

On the same point: Is there short-circuiting of such conditions, i.e.
will the execution will stop looking for further WHEN matches if some
rule matches, or will it rather check all rules and raise an error if
more than one WHEN rules match each given row?

* Your last example uses ELSE but that appears nowhere in the synopsys.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2017-10-27 12:54:26 Re: parallel.c oblivion of worker-startup failures
Previous Message Daniele Varrazzo 2017-10-27 12:24:50 Linking libpq statically to libssl