pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove arbitrary FUNC_MAX_ARGS limit in int2vectorin and oidvect
Date: Sun, 15 Jan 2023 22:32:14 +0000
Message-ID: <E1pHBXy-003r9f-8z@gemulon.postgresql.org> (raw)

Remove arbitrary FUNC_MAX_ARGS limit in int2vectorin and oidvectorin.

int2vectorin limited the number of array elements it'd take to
FUNC_MAX_ARGS, which is probably fine for the traditional use-cases.
But now that pg_publication_rel.prattrs is an int2vector, it's not
fine at all: it's easy to construct cases where that can have up to
about MaxTupleAttributeNumber entries.  Trying to replicate such
tables leads to logical-replication failures.

As long as we have to touch this code anyway, let's just remove
the a-priori limit altogether, and let it accept any size that'll
be allowed by repalloc.  (Note that since int2vector isn't toastable,
we cannot store arrays longer than about BLCKSZ/2; but there is no
good excuse for letting int2vectorin depend on that.  Perhaps we
will lift the no-toast restriction someday.)

While at it, also improve the equivalent logic in oidvectorin.
I don't know of any practical use-case for long oidvectors right
now, but doing it right actually makes the code shorter.

Per report from Erik Rijkers.  Back-patch to v15 where
pg_publication_rel.prattrs was added.

Discussion: https://postgr.es/m/668ba539-33c5-8190-ca11-def2913cb94b@xs4all.nl

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/db9127c58cbaa748d00055ce10c6bf50a7fbcc1e

Modified Files
--------------
src/backend/utils/adt/int.c | 26 +++++++++++---------------
src/backend/utils/adt/oid.c | 25 +++++++++++--------------
2 files changed, 22 insertions(+), 29 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1pHBXy-003r9f-8z@gemulon.postgresql.org>
Permalink:  ../E1pHBXy-003r9f-8z@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pHBXy-003r9f-8z@gemulon.postgresql.org

 · 

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
  Subject: Re: pgsql: Remove arbitrary FUNC_MAX_ARGS limit in int2vectorin and oidvect
  In-Reply-To: <E1pHBXy-003r9f-8z@gemulon.postgresql.org>
  References: <E1pHBXy-003r9f-8z@gemulon.postgresql.org>

* 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