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:
parent
a1c9ea26ce
commit
78c832eb1f
@ -311,6 +311,14 @@ public class jrunner {
|
|||||||
nr = "";
|
nr = "";
|
||||||
for (int i = 1; i <= cols; i++){
|
for (int i = 1; i <= cols; i++){
|
||||||
switch (dtn[i].toUpperCase()){
|
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 "VARCHAR":
|
||||||
case "NVARCHAR":
|
case "NVARCHAR":
|
||||||
nc = rs.getString(i);
|
nc = rs.getString(i);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user