| From: | Kenny Chen <kennychen851228(at)gmail(dot)com> |
|---|---|
| To: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
| Cc: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, "1217816127(at)qq(dot)com" <1217816127(at)qq(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: BUG #19547: libpqrcv_create_slot dereferences NULL on a malformed CREATE_REPLICATION_SLOT reply |
| Date: | 2026-07-15 14:24:20 |
| Message-ID: | CAPXstDuCbQQnk20=t9Wjs4bt4QQ5UhpXcHk1u23mHJhXTOVJcw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi Fujii,
> "PQnfields(res) < 4" should be "PQnfields(res) != 4"?
> If so, "or more" in the detail message should be removed as well.
Right, CREATE_REPLICATION_SLOT always returns exactly 4 columns, so != 4 is
more accurate. v3 attached uses != 4 and drops "or more" from the errdetail.
Regards,
Kenny
Fujii Masao <masao(dot)fujii(at)gmail(dot)com> 於 2026年7月15日週三 下午10:10寫道:
>
> On Wed, Jul 15, 2026 at 8:51 PM Kenny Chen <kennychen851228(at)gmail(dot)com> wrote:
> > Agreed. IDENTIFY_SYSTEM tolerates 3 columns only because older servers (9.3
> > and earlier) actually returned 3, whereas CREATE_REPLICATION_SLOT has always
> > returned 4, so there is no reason to be lenient here. v2 attached requires 4
> > fields, and updates the comment and errdetail accordingly.
>
> Agreed. So,
>
> + if (PQnfields(res) < 4 || PQntuples(res) != 1)
> + ereport(ERROR,
> + (errcode(ERRCODE_PROTOCOL_VIOLATION),
> + errmsg("invalid response from primary server"),
> + errdetail("Could not create
> replication slot \"%s\": got %d rows and %d fields, expected %d rows
> and %d or more fields.",
> + slotname,
> PQntuples(res), PQnfields(res), 1, 4)));
>
> "PQnfields(res) < 4" should be "PQnfields(res) != 4"?
> If so, "or more" in the detail message should be removed as well.
>
> Regards,
>
> --
> Fujii Masao
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Avoid-crash-on-malformed-CREATE_REPLICATION_SLOT-.patch | application/octet-stream | 2.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-07-15 18:29:04 | Re: CREATE INDEX with an expression in an INCLUDE column fails with XX000 "unrecognized node type" instead of 0A000 on master |
| Previous Message | Fujii Masao | 2026-07-15 14:10:15 | Re: BUG #19547: libpqrcv_create_slot dereferences NULL on a malformed CREATE_REPLICATION_SLOT reply |