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.96) (envelope-from ) id 1wu4Tn-000Rxa-0V for pgsql-bugs@arkaria.postgresql.org; Wed, 12 Aug 2026 08:38:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wu4Sl-006VWk-2E for pgsql-bugs@arkaria.postgresql.org; Wed, 12 Aug 2026 08:37:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wu4Sl-006VVe-19 for pgsql-bugs@lists.postgresql.org; Wed, 12 Aug 2026 08:37:28 +0000 Received: from stravinsky.debian.org ([2001:41b8:202:deb::311:108]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wu4Sk-00000000FIs-1Jgz for pgsql-bugs@lists.postgresql.org; Wed, 12 Aug 2026 08:37:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description; bh=cQK6mtlJQvFAaqUsNwRPWT/5g7GYP28Mdv5E1oiRqnQ=; b=J0Vn7PgIegP1wHrqtxFEz+pvud LKlhOBe5XiD/zu/1iVL0DIysp7eO/nqnS/7ubUJz1W2AaChnJ3blwYhoIrL3Hlyv18C+0I9qt1i56 pYdAW3VRAuUS75YXAsCgUueyfA5e1D6NxBu2nLN1KKyJ8KwRVOt3iJax8o3zQxJycWOMnCFAI91sv yy/tUwptinMYF88r2E+yhHJ+gCqq+LNqurj1C9+4KXHW4h55rNrSIINADO8p4TNSJx16nw23kBNWf Y+at83qMVo97btH0go+ao0RO2N7mbR/X8d2d8CgrtxCgUJ12IvsBKczXhqSFETCrruTaC/aAhfExn CclEmlvw==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wu4Sd-004DRk-0c; Wed, 12 Aug 2026 08:37:19 +0000 Date: Wed, 12 Aug 2026 10:37:18 +0200 From: Christoph Berg To: Zsolt Parragi Cc: pgsql-bugs@lists.postgresql.org Subject: Re: COPY TO regression with psql -c Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Debian-User: myon List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Re: Zsolt Parragi > psql -c "SELECT 1; COPY t FROM STDIN;" The Debian package tests are also tripping over this. The test case there is (in the encoding test file, hence the weird chars): printf '���' | psql -qc "set client_encoding='iso-8859-5'; create table t (x varchar); copy t from stdin" SET CREATE TABLE unexpected COPY_IN result, aborting connection 2026-08-12 10:31:46.434 CEST [77760] ERROR: unexpected EOF on client connection with an open transaction 2026-08-12 10:31:46.434 CEST [77760] CONTEXT: COPY t, line 1 2026-08-12 10:31:46.434 CEST [77760] STATEMENT: set client_encoding='iso-8859-5'; create table t (x varchar); copy t from stdin 2026-08-12 10:31:46.434 CEST [77760] LOG: could not send data to client: Broken pipe 2026-08-12 10:31:46.434 CEST [77760] STATEMENT: set client_encoding='iso-8859-5'; create table t (x varchar); copy t from stdin 2026-08-12 10:31:46.434 CEST [77760] FATAL: terminating connection because protocol synchronization was lost > This is probably an uncommon use case, but it has a few legitimate > uses in scripts, such as: > > gzip -dc data.csv.gz | psql -c 'TRUNCATE t; COPY t FROM STDIN WITH (FORMAT CSV)' I think that's a pretty common case. This "create and copy" is another example. Christoph