From f7a741f1f525db54625e00bae0ac4bdd2fdae7f6 Mon Sep 17 00:00:00 2001 From: Milton Mazzarri Date: Wed, 5 Aug 2026 13:50:25 -0500 Subject: [PATCH] Decode void type on CockroachDB CockroachDB names the void type's send/output procs without underscores (voidsend / voidout), so the built-in VoidBinary/VoidText extensions never bind and `SELECT`s returning void (e.g. pg_advisory_xact_lock/1) raise `type "void" can not be handled`. Match CRDB's proc spelling in addition to Postgres' so void decodes on both engines. The wire format is identical; only the matching changes, and the Postgres path is unaffected. --- CHANGELOG.md | 1 + lib/postgrex/extensions/void_binary.ex | 4 +++- lib/postgrex/extensions/void_text.ex | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b61646af..4cb1d397 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * Fix composite type loading when `record_send` is duplicated * Fix encoding of domains over composite types * Enforce integer bounds in type encoders + * Decode the `void` type on CockroachDB (`voidsend`/`voidout`) ## v0.22.3 (2026-07-09) diff --git a/lib/postgrex/extensions/void_binary.ex b/lib/postgrex/extensions/void_binary.ex index 36085878..8554621b 100644 --- a/lib/postgrex/extensions/void_binary.ex +++ b/lib/postgrex/extensions/void_binary.ex @@ -1,7 +1,9 @@ defmodule Postgrex.Extensions.VoidBinary do @moduledoc false import Postgrex.BinaryUtils, warn: false - use Postgrex.BinaryExtension, send: "void_send" + # CockroachDB names void's send/output procs without underscores + # (voidsend / voidout), so match its spelling in addition to Postgres'. + use Postgrex.BinaryExtension, send: "void_send", send: "voidsend" def encode(_) do quote location: :keep do diff --git a/lib/postgrex/extensions/void_text.ex b/lib/postgrex/extensions/void_text.ex index b35bff70..836904b4 100644 --- a/lib/postgrex/extensions/void_text.ex +++ b/lib/postgrex/extensions/void_text.ex @@ -5,7 +5,9 @@ defmodule Postgrex.Extensions.VoidText do def init(_), do: nil - def matching(_), do: [output: "void_out"] + # CockroachDB names void's send/output procs without underscores + # (voidsend / voidout), so match its spelling in addition to Postgres'. + def matching(_), do: [output: "void_out", output: "voidout"] def format(_), do: :text