With the following file:
% cat a.sql
begin;
create table tbl (b bytea);
copy tbl from stdin;
\\xfefe
\.
select b from tbl;
rollback;
PostgreSQL inserts it as bytea:
% psql -X 'postgres://pqgo@localhost/pqgo' <a.sql
BEGIN
CREATE TABLE
COPY 1
b
--------
\xfefe
(1 row)
ROLLBACK
But CockroachDB inserts it as a string:
% psql -X 'postgres://pqgo@localhost:26257/pqgo' <a.sql
BEGIN
CREATE TABLE
COPY 1
b
----------------
\x5c7866656665
(1 row)
ROLLBACK
\x5c7866656665 is \xfefe.
It looks like this was fixed a few years ago in #69640 (or something similar, anyway), so I think this ought to work?
This originally came up in the context of lib/pq#1304 – to reproduce it there you need to uncomment the pqtest.SkipCockroach and run:
% docker compose up -d cockroach
% PGPORT=26257 go test -run TestCopyInTypes
CockroachDB CCL v26.1.1 (x86_64-pc-linux-gnu, built 2026/03/04 12:08:22, go1.25.5)
Jira issue: CRDB-62373
Epic CRDB-62230
With the following file:
PostgreSQL inserts it as bytea:
But CockroachDB inserts it as a string:
\x5c7866656665is\xfefe.It looks like this was fixed a few years ago in #69640 (or something similar, anyway), so I think this ought to work?
This originally came up in the context of lib/pq#1304 – to reproduce it there you need to uncomment the
pqtest.SkipCockroachand run:CockroachDB CCL v26.1.1 (x86_64-pc-linux-gnu, built 2026/03/04 12:08:22, go1.25.5)
Jira issue: CRDB-62373
Epic CRDB-62230