From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Ranier Vilela <ranier.vf@gmail.com>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: Amit Langote <amitlangote09@gmail.com>
Cc: Japin Li <japinli@hotmail.com>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: simon.riggs@enterprisedb.co, Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: Daniel Westermann <dwe@dbi-services.com>
Cc: Erik Rijkers <er@xs4all.nl>
Cc: Jaime Casanova <jcasanov@systemguards.com.ec>
Cc: Andres Freund <andres@anarazel.de>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: support for MERGE
Date: Tue, 12 Apr 2022 15:47:08 +0200
Message-ID: <202204121347.2s2p6eed5mv2@alvherre.pgsql> (raw)
In-Reply-To: <CAEudQApp3aHZ+Vfn0Drx1hc+=pOnvZ7dMxJqcbf5t_riS0ZXqA@mail.gmail.com>
On 2022-Apr-02, Ranier Vilela wrote:
> Em sáb., 2 de abr. de 2022 às 12:01, Alvaro Herrera <alvherre@alvh.no-ip.org>
> escreveu:
> IMHO, actually there are bug here.
> ExecGetChildToRootMap is clear, is possible returning NULL.
> To discover if the map is NULL, ExecGetChildToRootMap needs to process
> "ResultRelInfo *leaf_part_rri".
> So, the argument "if the map is NULL, this function should not be called",
> is contradictory.
I was not explicit enough. I meant "if no map is needed to adjust
columns, then this function should not be called". The caller already
knows if it's needed or not; it doesn't depend on literally testing
'map'. If somebody mis-calls this function, it would have crashed, yes;
but that's a caller bug, not this function's.
A few days ago, the community Coverity also complained about this, so I
added an Assert that the map is not null, which should silence it.
> If the right fix is to return the original list, here is the patch attached.
... for a buggy caller (one that calls it when unnecessary), then yes
this would be the correct code -- except that now the caller doesn't
know if the returned list needs to be freed or not. So it seems better
to avoid accumulating pointless calls to this function by just not
coping with them.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"I suspect most samba developers are already technically insane...
Of course, since many of them are Australians, you can't tell." (L. Torvalds)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, ranier.vf@gmail.com, daniel@yesql.se, peter.eisentraut@enterprisedb.com, pryzby@telsasoft.com, amitlangote09@gmail.com, japinli@hotmail.com, zyu@yugabyte.com, tomas.vondra@enterprisedb.com, dwe@dbi-services.com, er@xs4all.nl, jcasanov@systemguards.com.ec, andres@anarazel.de
Subject: Re: support for MERGE
In-Reply-To: <202204121347.2s2p6eed5mv2@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox