fix: quote json/jsonb/bpchar/uuid values in migration INSERTs

The migration INSERT builder's switch quoted varchar/text/char/clob/date/time
but let everything else fall to a default that emits rs.getString() unquoted
(correct for numerics, broken for strings). A pg->SQL Server pull of a jsonb
column failed with "Incorrect syntax near 'volume_bucket'" — the JSON text's
embedded double-quotes were read as a SQL identifier. Quote json/jsonb, plus
bpchar (PG char(n)) and uuid, like varchar.

Note: the default case still emits unquoted; other unhandled string types
(e.g. bool->'t'/'f') would need similar handling or a quote-by-default flip.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Paul Trowbridge 2026-06-17 16:31:45 -04:00
parent a1c9ea26ce
commit 78c832eb1f

View File

@ -311,6 +311,14 @@ public class jrunner {
nr = "";
for (int i = 1; i <= cols; i++){
switch (dtn[i].toUpperCase()){
// PG string-ish types that otherwise fall to the default
// case and get emitted UNQUOTED (breaking the INSERT):
// jsonb/json carry embedded quotes, bpchar is PG's char(n),
// uuid is a quoted literal. Quote them like varchar.
case "JSON":
case "JSONB":
case "BPCHAR":
case "UUID":
case "VARCHAR":
case "NVARCHAR":
nc = rs.getString(i);