pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Shlok Kyal <shlok.kyal.oss@gmail.com>
Cc: Noah Misch <noah@leadboat.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: CREATE SUBSCRIPTION ... SERVER vs. pg_dump, etc.
Date: Sun, 09 Aug 2026 22:15:53 -0400
Message-ID: <1787286.1786328153@sss.pgh.pa.us> (raw)
In-Reply-To: <95a4a0d1f9b1a2e9d2e339b41b532131571150af.camel@j-davis.com>
References: <20260710195902.4f.noahmisch@microsoft.com>
	<65960c946d048687a254501dcfedf23956968620.camel@j-davis.com>
	<CAA4eK1KEnEAW8UWEwxf5UGxE7Qttf3=AnobuxVZUr9e9TiQnqg@mail.gmail.com>
	<d7d168cb94fb5543fd603a4deb79e4a253a5725a.camel@j-davis.com>
	<CANhcyEWRTw6-eD94q2e=MuwUYDqpkmaVQsOK8ZE1L2t+NjoDFg@mail.gmail.com>
	<CAA4eK1LpnhyRA2-CuHTPQZG_kXnhi8PegEHdinv=iEQ-pHZYaQ@mail.gmail.com>
	<95a4a0d1f9b1a2e9d2e339b41b532131571150af.camel@j-davis.com>

Jeff Davis <pgsql@j-davis.com> writes:
> On Wed, 2026-08-05 at 16:47 +0530, Amit Kapila wrote:
>> BTW, I had also looked at the overall patch series, the idea and
>> high-level code looks good to me. Though I haven't done a detailed
>> testing or review of the same but as Shlok and Kuroda-San seem to
>> have
>> reviewed/tested these patches, I think we can go-ahead with these
>> fixes.

> Thank you all, pushed.

Coverity thinks there is a hole in this logic:

/srv/coverity/git/pgsql-git/postgresql/src/backend/commands/subscriptioncmds.c: 875             in CreateSubscription()
869     	values[Anum_pg_subscription_submaxretention - 1] =
870     		Int32GetDatum(opts.maxretention);
871     	values[Anum_pg_subscription_subretentionactive - 1] =
872     		BoolGetDatum(opts.retaindeadtuples);
873     	values[Anum_pg_subscription_subserver - 1] = ObjectIdGetDatum(serverid);
874     	if (!OidIsValid(serverid))
>>>     CID 1699896:         Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "conninfo" to "cstring_to_text", which dereferences it.
875     		values[Anum_pg_subscription_subconninfo - 1] =
876     			CStringGetTextDatum(conninfo);
877     	else
878     		nulls[Anum_pg_subscription_subconninfo - 1] = true;
879     	if (opts.slot_name)
880     		values[Anum_pg_subscription_subslotname - 1] =

AFAICS, it's right: if stmt->servername is set while opts.connect is
not, we'll arrive at this step with serverid filled in but conninfo
still NULL.  Even if there's some upstream reason why that combination
can't occur, this is pretty fragile-looking code.  It's far from clear
why serverid has anything to do with conninfo being available.

			regards, tom lane






view thread (27+ messages)  latest in thread

Message-ID: <1787286.1786328153@sss.pgh.pa.us>
Permalink:  ../1787286.1786328153@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1787286.1786328153@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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql@j-davis.com, amit.kapila16@gmail.com, shlok.kyal.oss@gmail.com, noah@leadboat.com
  Subject: Re: CREATE SUBSCRIPTION ... SERVER vs. pg_dump, etc.
  In-Reply-To: <1787286.1786328153@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