Repository navigation
fix(postgres): read and write arrays with their element's delimiter - #84
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
ℹ️ No critical issues — one small redundant argument inline.
Reviewed changes
I reviewed the whole diff: the engine now records the element delimiter from the catalog, the module carries it, and the run time uses it.
typdelimin the type registry:TYPE_QUERYandRELATION_TYPES_QUERYnow readt.typdelim.insert_rowskeeps it only when it is not a comma, andrenderputs the element's delimiter onType::Array. A domain picks up its base type's delimiter, because the catalog copies it onto the domain's row. Bothbox(not inBUILTINS, so it is looked up) and PostGIS'sgeometryget theirs.with_itemspreserves it: every otherType::Arraysite is mechanical (delimiter: None). All threeengine.wasmfiles are rebuilt, as a change under core requires, and the fingerprint in the.reylo/cache key throws away entries cached without the delimiter.- Module columns
[name, kind, delimiter?]:arrayDelimiterinsrc/values.tsproduces them. Inputs already carry the fullEngineType, sodelimiterreachesarrayLiteralfor parameters, nested arrays included. - Decoders:
fieldDecodersseeds the client's learned types with the column's delimiter, so later hand-defined queries on the same client decode correctly too. Bun.sql passes the delimiter throughbunValuetocoerce. The catalog path (learn) already readtypdelimbefore this PR.
claude-opus-5-5 | 𝕏
PostGIS's geometry and geography separate array elements with ':' (box with ';'), so a geometry[] column came back as one merged string and a geometry[] parameter failed as a malformed array literal. The engine reads typdelim with each type, an array type carries it, and the module's columns and inputs hand it to the decoders and arrayLiteral.
colinhacks
force-pushed
the
fix-array-delimiter
branch
from
October 23, 2026 20:48
ab85092 to
93d7570
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PostGIS's
geometryandgeographyseparate the elements of an array with:, not,(theirtypdelim), and so does built-inboxwith;. Reylo assumed a comma wherever a module told it a column's kind:select array['POINT(1 2)'::geometry, 'POINT(3 4)']came back from.run()as one merged string,['0101…:0101…'], on the module path of every Postgres driver (the decoder learned the created type from the module's column kind with a,delimiter, and kept that for the client, so a hand-defined query on the same client inherited it). Bun.sql's string arrays went throughcoerce's comma too.where g = any(:gs)with two or more geometries failed withmalformed array literal, sincearrayLiteralalways joined with,.The fix carries the delimiter from the catalog:
typdelim; an array type (Type::Array,EngineType'sarray) carriesdelimiterwhere its element's is not a comma. A domain has its base type's.["shapes", "text[]", ":"], which the pg-family, PGlite, postgres.js and Bun.sql decoders use.arrayLiteralwrites an array parameter with the delimiter its input type carries, between sub-arrays too.Tests: the decode fakes gain a created array type with
:, on every Postgres driver's path (8 tests fail without the fix),arrayLiteralwith:and;, a parameter bound through a module's inputs, and an engine unit test for the delimiter of a type's array and of a domain's. Checked live on Supabase's and Neon's Postgres 17 images with PostGIS; the driver matrix (4154 rows over 57 jobs, 0 different), the oracle, the loader's tests and the rebuiltengine.wasmpass.