pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Amit Kapila <akapila@postgresql.org>
Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
Subject: Re: pgsql: Implement streaming mode in ReorderBuffer.
Date: Tue, 27 Apr 2021 23:21:10 -0400
Message-ID: <2760469.1619580070@sss.pgh.pa.us> (raw)
In-Reply-To: <CAA4eK1+f_Z7J52F0hrFgc1-Phnghk+v=eX9mgf7+GyR4sNN+bw@mail.gmail.com>
References: <E1k4Ebl-0006ps-1P@gemulon.postgresql.org>
	<2752962.1619568098@sss.pgh.pa.us>
	<CAA4eK1+f_Z7J52F0hrFgc1-Phnghk+v=eX9mgf7+GyR4sNN+bw@mail.gmail.com>

Amit Kapila <amit.kapila16@gmail.com> writes:
> On Wed, Apr 28, 2021 at 5:31 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> It's griping about this:
>> 		curtxn->concurrent_abort = true;
>> and I think it's got a point.  There is little if any reason to have
>> confidence that curtxn must be non-NULL when this code is reached,
>> because it's in a PG_CATCH segment and there is a lot of code within
>> the PG_TRY that could throw an error before the spot where curtxn
>> is set.  Not to mention that curtxn is set only conditionally.

> We can do that to silence this Warning, otherwise, there won't be any
> problem because it is set only when we get a particular error code and
> we can get that error code only when the conditions that lead to
> curtxn being set are met.

To be blunt, that argument is hopelessly naive.  You cannot safely
make assumptions about a CATCH block having omniscient knowledge
of where an error was thrown from.  At least, not with a check
no stronger than checking the SQLSTATE.  All you need is some
extension ... or a user-defined function ... deciding to throw
that same SQLSTATE, and you're hosed.

If this code really does make the assumption that there's
only one possible cause of that SQLSTATE, I wonder whether
it's broken in ways worse than a mere core dump.

			regards, tom lane





view thread (10+ messages)  latest in thread

Message-ID: <2760469.1619580070@sss.pgh.pa.us>
Permalink:  ../2760469.1619580070@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2760469.1619580070@sss.pgh.pa.us

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, amit.kapila16@gmail.com, akapila@postgresql.org
  Subject: Re: pgsql: Implement streaming mode in ReorderBuffer.
  In-Reply-To: <2760469.1619580070@sss.pgh.pa.us>
  References: <E1k4Ebl-0006ps-1P@gemulon.postgresql.org> <2752962.1619568098@sss.pgh.pa.us> <CAA4eK1+f_Z7J52F0hrFgc1-Phnghk+v=eX9mgf7+GyR4sNN+bw@mail.gmail.com> <2760469.1619580070@sss.pgh.pa.us>

* 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