`convert_from()` is not found
On DoltgreSQL 1.3.1, convert_from, the function that turns bytes in a named encoding into text, does not
exist, while its inverse convert_to works. SELECT convert_from('\x68656c6c6f'::bytea, 'UTF8') answers:
ERROR: function: 'convert_from' not found
PostgreSQL 18.6 returns hello.
Reproduction
-- convert_to: text to bytes in the UTF8 encoding.
SELECT convert_to('hello', 'UTF8');
-- convert_from: the same bytes back to text.
SELECT convert_from('\x68656c6c6f'::bytea, 'UTF8');
Expected behavior
Both statements succeed: convert_to turns hello into the bytes \x68656c6c6f, and convert_from turns
those bytes back into hello. This is what PostgreSQL 18.6 does:
-- convert_to: text to bytes in the UTF8 encoding.
SELECT convert_to('hello', 'UTF8');
convert_to
--------------
\x68656c6c6f
(1 row)
-- convert_from: the same bytes back to text.
SELECT convert_from('\x68656c6c6f'::bytea, 'UTF8');
convert_from
--------------
hello
(1 row)
Actual behavior
convert_to returns the same bytes as on PostgreSQL, but convert_from is not found. This is what
DoltgreSQL 1.3.1 does:
-- convert_to: text to bytes in the UTF8 encoding.
SELECT convert_to('hello', 'UTF8');
convert_to
--------------
\x68656c6c6f
(1 row)
-- convert_from: the same bytes back to text.
SELECT convert_from('\x68656c6c6f'::bytea, 'UTF8');
psql:/tmp/repro.sql:5: ERROR: function: 'convert_from' not found
Run it
A runnable reproduction is at https://github.com/Reliable-Collaboration/repro-doltgresql-bug-convert-from. Its script runs the test on PostgreSQL and DoltgreSQL in throwaway containers and prints the two outputs side by side:
git clone https://github.com/Reliable-Collaboration/repro-doltgresql-bug-convert-from.git
cd repro-doltgresql-bug-convert-from
./repro.sh
Other observations
Each was run with psql on DoltgreSQL 1.3.1 and on PostgreSQL 18.6, in containers from the same images:
- Every other call of
convert_fromtried answers the samefunction: 'convert_from' not found:SELECT convert_from('\x68656c6c6f', 'UTF8');with an untyped argument,SELECT pg_catalog.convert_from('\x68656c6c6f'::bytea, 'UTF8');, the encoding names'LATIN1'and'utf-8', andSELECT convert_from(convert_to('hello', 'UTF8'), 'UTF8');. PostgreSQL returnshellofor each. SELECT convert_from('\xe9'::bytea, 'LATIN1');answers the same error. PostgreSQL returnsé.- Over a
byteacolumn,SELECT id, convert_from(b, 'UTF8') FROM t;andCREATE VIEW v AS SELECT id, convert_from(b, 'UTF8') AS s FROM t;answer the same error. PostgreSQL returnshelloand creates the view. - These match PostgreSQL:
convert_to(chr(233), 'LATIN1')returns\xe9andconvert_to(chr(233), 'UTF8')returns\xc3a9;encodewith'escape','hex'and'base64'returnshello,68656c6c6fandaGVsbG8=;SELECT length('\x68656c6c6f'::bytea);returns5. decodeis not found either:SELECT decode('68656c6c6f', 'hex');,SELECT decode('aGVsbG8=', 'base64');andSELECT decode('hello', 'escape');answerfunction: 'decode' not found. PostgreSQL returns\x68656c6c6ffor each.SELECT convert('\x68656c6c6f'::bytea, 'UTF8', 'LATIN1');answersfunction: 'convert' not found, andSELECT length('\x68656c6c6f'::bytea, 'UTF8');answersfunction length(bytea, unknown) does not exist. PostgreSQL returns\x68656c6c6fand5.SELECT proname FROM pg_proc WHERE proname IN ('convert_from', 'convert_to', 'convert', 'encode', 'decode') ORDER BY 1;returns(0 rows), including for the two functions that work. PostgreSQL returns all five. Possibly related: dolthub/doltgresql#3190.convert_towas added in dolthub/doltgresql#3189. The feature list in dolthub/doltgresql#3099 marksconvert_todone and does not nameconvert_from.
Possibly related
#3099 (open) tracks missing functions and marks convert_to as added; it does not list convert_from. #3190 (open) covers DoltgreSQL's function catalog not listing these functions.
Environment
- DoltgreSQL 1.3.1: image
dolthub/doltgresql:1.3.1, digestsha256:6c85cb1f35beabf47f094336a420255130b841b1645f36d79ef046276af36851. Its bundledpsqlis 17.11. - PostgreSQL 18.6: image
postgres:18.6-bookworm, digestsha256:1c59e2c3c818eaa0f0628f695b36e7c9e362d6b219b36a54a32df645cbd7e1af. Itspsqlis 18.6. - Reproduced on 2026-09-11 (UTC) with Docker 29.7.2 on Ubuntu 26.04.1 LTS under WSL 2 (Linux 6.18.33.2-microsoft-standard-WSL2, x86_64).