pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <amitlangote09@gmail.com>
Cc: fedor_erastov@mail.ru, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Cc: Andres Freund <andres@anarazel.de>
Cc: Andrew Dunstan <andrew@dunslane.net>
Subject: Re: BUG #16644: null value for defaults in OLD variable for trigger
Date: Fri, 23 Oct 2020 11:52:09 -0400
Message-ID: <207142.1603468329@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+HiwqH7ys=WmnbGm+wgQwt0WzvQ-R-Qn4vdE01Q_QsX7cyFsw@mail.gmail.com>
References: <16644-5da7ef98a7ac4545@postgresql.org>
	<802555.1601432494@sss.pgh.pa.us>
	<CA+HiwqH7ys=WmnbGm+wgQwt0WzvQ-R-Qn4vdE01Q_QsX7cyFsw@mail.gmail.com>

Amit Langote <amitlangote09@gmail.com> writes:
> On Wed, Sep 30, 2020 at 11:21 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I've not tried to find where is the difference between 11 and
>> 12 that makes it fail or not fail.

> In v11, GetTupleForTrigger() expands the HeapTuple, with this:

>     /*
>      * While this is not necessary anymore after 297d627e, as a defense
>      * against C code that has not recompiled for minor releases after the
>      * fix, continue to expand the tuple.
>      */
>     if (HeapTupleHeaderGetNatts(tuple.t_data) < relation->rd_att->natts)
>         result = heap_expand_tuple(&tuple, relation->rd_att);
>     else
>         result = heap_copytuple(&tuple);
>     ReleaseBuffer(buffer);

Ah, good sleuthing.

>> I think we can band-aid this immediate problem by forcing
>> trigger.c to materialize the "old" tuples it fetches from disk
>> (or whatever needs to be done to substitute missing values into
>> them).

> Maybe something like the attached?

Probably needs some attention to memory management (e.g.,
should_free_trig) but I'm okay with doing this as a short-term
fix.  I remain worried about similar instances elsewhere, but
I have no good ideas about how to find them.

			regards, tom lane





view thread (10+ messages)  latest in thread

Message-ID: <207142.1603468329@sss.pgh.pa.us>
Permalink:  ../207142.1603468329@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/207142.1603468329@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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, amitlangote09@gmail.com, pgsql-bugs@lists.postgresql.org, andres@anarazel.de, andrew@dunslane.net
  Subject: Re: BUG #16644: null value for defaults in OLD variable for trigger
  In-Reply-To: <207142.1603468329@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