public inbox for [email protected]  
help / color / mirror / Atom feed
From: Fujii Masao <[email protected]>
To: jian he <[email protected]>
Cc: SATYANARAYANA NARLAPURAM <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: COPY FROM ON_ERROR SET_NULL bypasses domain NOT NULL with partial column list
Date: Mon, 18 May 2026 22:22:13 +0900
Message-ID: <CAHGQGwEvUj+ycr5vYMPQhZ8gk1of4HiSGfKVBJ15nA8d3MyDhQ@mail.gmail.com> (raw)
In-Reply-To: <CACJufxEYGY5twGooBDU4ttpb0SOQuOb8dYKoBsEML8dObAf4ZQ@mail.gmail.com>
References: <CAHg+QDdej0c0gWJi2FnbirzhgzyZNPiTwC1P5B_-dSNCzq-91A@mail.gmail.com>
	<CACJufxEYGY5twGooBDU4ttpb0SOQuOb8dYKoBsEML8dObAf4ZQ@mail.gmail.com>

On Fri, Apr 17, 2026 at 12:59 PM jian he <[email protected]> wrote:
>
> On Fri, Apr 17, 2026 at 1:09 AM SATYANARAYANA NARLAPURAM
> <[email protected]> wrote:
> >
> > HI hackers,
> >
> > domain_with_constraint[] was allocated with list_length(attnumlist)
> > elements and indexed sequentially via foreach_current_index(), but
> > copyfromparse.c accesses it via attnum - 1 (physical attribute index).
> > With a partial column list targeting high-numbered columns, this caused
> > an out-of-bounds read that bypassed domain NOT NULL checks, silently
> > inserting NULL into NOT NULL domain columns.
> >
> > Fix by allocating with num_phys_attrs and indexing by attnum - 1,
> > consistent with all other per-column arrays in BeginCopyFrom().
> >
> > Patch is attached, and added a new test case to cover this scenario.
> >
>
> The patch looks good to me.
> I simplified the tests.

The patch looks good to me. Barring any objections, I will commit it.

Regards,

-- 
Fujii Masao






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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: COPY FROM ON_ERROR SET_NULL bypasses domain NOT NULL with partial column list
  In-Reply-To: <CAHGQGwEvUj+ycr5vYMPQhZ8gk1of4HiSGfKVBJ15nA8d3MyDhQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox