Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xKyLG-00000001EBc-415l for pgsql-bugs@arkaria.postgresql.org; Sun, 25 Oct 2026 13:32:55 +0000 Received: from localhost ([127.0.0.1]:35404 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xKyLG-000000032UX-25b5 for pgsql-bugs@arkaria.postgresql.org; Sun, 25 Oct 2026 13:32:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]:45266) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xKkEg-00000001zBh-1MlN for pgsql-bugs@lists.postgresql.org; Sat, 24 Oct 2026 22:29:10 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xKkEd-00000000ndq-1mg0 for pgsql-bugs@lists.postgresql.org; Sat, 24 Oct 2026 22:29:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=UzXBljytuypsFpJ4ctZG0CdWVNJBDugwyz3ZVD1jcdU=; b=6ZNQ8S29gcr/Dgoub2cZkpgN6g J2Ht9hdIyZYViTzYtfhTbtctkHqJYlZc+22hzUei5yxzpLUV1qXa7lVwWw7Si0xds2EzEPg8bHSOo H862R1VfRocMBqhnWTBekgLIqpR8w2LruAuqBx8Auq7mR1zsOESHsxt9pOsm4o6vyvry6VHYKH2g4 InlEPGCmDocTPFzoPhvwC8REVmdukZgxe+XaDukHGb+Hb+3bmIpSGRGYPvMmvOn8f1ty+1cvb386O V0hDBallodRb7PKMJ8iV7BpzLKCN5nT2Q813HwSZ4a1wO4YXGHedrblKDfQQAeWgrsVQ837Z82cfb xgnbUMEg==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xKkEb-00000002Cvc-1DaG for pgsql-bugs@lists.postgresql.org; Sat, 24 Oct 2026 22:29:06 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xKkEZ-00000006eQs-46df for pgsql-bugs@lists.postgresql.org; Sat, 24 Oct 2026 22:29:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19795: pgoutput: walsender crashes on START_REPLICATION option without a value To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: brar@gmx.de Reply-To: brar@gmx.de, pgsql-bugs@lists.postgresql.org Date: Sat, 24 Oct 2026 22:28:23 +0000 Message-ID: <19795-6d7d506133b7f062@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19795 Logged by: Brar Piening Email address: brar@gmx.de PostgreSQL version: 18.6 Operating system: Windows 11 x64 (EDB installer builds) Description: =20 A START_REPLICATION option without a value crashes the walsender when the output plugin is pgoutput and the option is proto_version or publication_names. The postmaster then restarts all sessions. A role with REPLICATION is enough; it doesn't need to be a superuser. Steps, on a fresh cluster with wal_level =3D logical: -- as a superuser CREATE PUBLICATION pub FOR ALL TABLES; SELECT pg_create_logical_replication_slot('s', 'pgoutput'); CREATE ROLE repuser LOGIN REPLICATION; pg_recvlogical -d postgres -U repuser --slot=3Ds --start -o proto_version= \ -f - --no-loop (Without --no-loop, pg_recvlogical sends the command again after a few seconds.) pg_recvlogical sends START_REPLICATION SLOT "s" LOGICAL 0/0 ("proto_version") and reports: pg_recvlogical: error: could not send replication command "START_REPLICATION SLOT "s" LOGICAL 0/0 ("proto_version")": server closed the connection unexpectedly Server log (18.6): LOG: client backend (PID 21132) was terminated by exception 0xC0000005 DETAIL: Failed process was running: START_REPLICATION SLOT "s" LOGICAL 0/0 ("proto_version") LOG: terminating any other active server processes LOG: all server processes terminated; reinitializing LOG: database system was not properly shut down; automatic recovery in progress ... LOG: database system is ready to accept connections "-o publication_names" crashes the same way. I reproduced both on 14.24, 15.19, 16.15, 17.11 and 18.6, all Windows builds, where the crash shows up as an access violation. Expected: an error, as for pgoutput's origin option without a value: ERROR: origin requires a parameter CONTEXT: slot "s", output plugin "pgoutput", in the startup callback Cause: the replication grammar accepts an option without a value and leaves DefElem.arg NULL (repl_gram.y, plugin_opt_arg: "| /* EMPTY */ { $$ =3D NULL; }"). parse_output_parameters() in pgoutput.c allows this ("Assert(defel->arg =3D= =3D NULL || IsA(defel->arg, String))"), but for proto_version and publication_names it calls strVal(defel->arg), which dereferences the NULL pointer. The other options are read with defGetBoolean() (a missing value means true) or defGetString() (origin, which raises the error above). The SQL functions such as pg_logical_slot_get_changes() can't produce a NULL arg, since logicalfuncs.c wraps every value in makeString(). So only the replication protocol path crashes. test_decoding checks for a NULL arg itself. Suggested fix: read both options with defGetString(defel), as origin does, on all supported branches. I found this while working on Npgsql (the .NET driver), whose generic logical replication API currently sends an option without a value when the caller passes null.