Re: [HACKERS] MERGE SQL Statement for PG11

Teodor Sigaev <teodor@sigaev.ru>

From: Teodor Sigaev <teodor@sigaev.ru>
To: Pavan Deolasee <pavan.deolasee@gmail.com>, Jesper Pedersen <jesper.pedersen@redhat.com>
Cc: Simon Riggs <simon@2ndquadrant.com>, Peter Geoghegan <pg@bowt.ie>, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, Robert Haas <robertmhaas@gmail.com>, Tomas Vondra <tomas.vondra@2ndquadrant.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Andrew Dunstan <andrew.dunstan@2ndquadrant.com>, Pavan Deolasee <pavan.deolasee@2ndquadrant.com>, Stephen Frost <sfrost@snowman.net>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2018-04-05T12:18:17Z
Lists: pgsql-hackers
> The variable would become unused in non-assert builds. I see that. But simply 
> removing it is not a solution and I don't think the code will compile that way. 
> We should either rewrite that assertion or put it inside a #ifdef 
> ASSERT_CHECKING block or simple remove that assertion because we already check 
> for relkind in parse_merge.c. Will check.
> 

That is noted by Kyotaro HORIGUCHI
https://www.postgresql.org/message-id/20180405.181730.125855581.horiguchi.kyotaro%40lab.ntt.co.jp

and his suggestion to use special macro looks better for me:
-   char        relkind;
+   char        relkind PG_USED_FOR_ASSERTS_ONLY;


-- 
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/


Commits

  1. Add support for MERGE SQL command

  2. Avoid repeated name lookups during table and index DDL.

  3. Use an MVCC snapshot, rather than SnapshotNow, for catalog scans.