Skip to content

fix: quote column names in json_to_recordset AS clause#954

Open
alexspeller wants to merge 1 commit intoelectric-sql:mainfrom
alexspeller:fix/json-insert-quote-column-names
Open

fix: quote column names in json_to_recordset AS clause#954
alexspeller wants to merge 1 commit intoelectric-sql:mainfrom
alexspeller:fix/json-insert-quote-column-names

Conversation

@alexspeller
Copy link
Copy Markdown

@alexspeller alexspeller commented Mar 30, 2026

Summary

  • Column names in the json_to_recordset AS clause were unquoted, so PostgreSQL lowercased them. CamelCase JSON keys (e.g. firstName) didn't match the lowercased column names (e.g. firstname), producing NULLs.
  • The insert and csv/COPY methods already properly double-quote column names — this aligns the json method with them.

Test plan

  • Added regression test with camelCase columns ("firstName", "lastName") using initialInsertMethod: 'json'
  • Confirmed test fails before fix (values are NULL)
  • Confirmed test passes after fix
  • Full pglite-sync test suite passes (17/17)

Column names in the json_to_recordset AS clause were unquoted, causing
PostgreSQL to lowercase them. This meant camelCase JSON keys didn't
match the lowercased column names, producing NULLs.

The insert and csv/COPY methods already properly double-quote column
names; this aligns the json method with them.
@alexspeller alexspeller force-pushed the fix/json-insert-quote-column-names branch from e98ce80 to bf640ad Compare March 30, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant