Skip to content

Crash on illagal CSV fileds converting into postgres v9.x #139

@tan-feng

Description

@tan-feng

The same source of mysql server v8,
successfully converted to postgresql v16, but always make nmig crash while converting into an
older postgresql server v9.2.

The following is the output on the screen:

SQL: ALTER TABLE "public"."classify" ALTER COLUMN "id" 
    ADD GENERATED BY DEFAULT AS IDENTITY;


--[IndexAndKeyProcessor::default] "public"."classify": PK/indices are successfully set...
--[CommentsProcessor::default] Creates comments for table "public"."classify"...
--[CommentsProcessor::processColumnsComments] Set comment for "public"."classify" column: "parent_id"...
--[CommentsProcessor::processColumnsComments] Set comment for "public"."classify" column: "id"...
--[CommentsProcessor::processColumnsComments] Set comment for "public"."classify" column: "classify_name"...
--[CommentsProcessor::processColumnsComments] Set comment for "public"."classify" column: "classify_owner"...
--[CommentsProcessor::processColumnsComments] Set comment for "public"."classify" column: "create_date"...
--[CommentsProcessor::processColumnsComments] Set comment for "public"."classify" column: "modify_date"...
--[CommentsProcessor::processColumnsComments] Set comment for "public"."classify" column: "remark"...
--[CommentsProcessor::processColumnsComments] Set comment for "public"."classify" column: "delete_date"...
--[CommentsProcessor::processTableComments] Successfully set comment for table "public"."classify"

node:events:495
throw er; // Unhandled 'error' event
^

error: terminating connection due to administrator command
at Parser.parseErrorMessage (/home/hz/NMIG/nmig/node_modules/pg-protocol/dist/parser.js:283:98)
at Parser.handlePacket (/home/hz/NMIG/nmig/node_modules/pg-protocol/dist/parser.js:122:29)
at Parser.parse (/home/hz/NMIG/nmig/node_modules/pg-protocol/dist/parser.js:35:38)
at Socket. (/home/hz/NMIG/nmig/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9)
at Readable.push (node:internal/streams/readable:278:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
Emitted 'error' event on Client instance at:
at Client._handleErrorEvent (/home/hz/NMIG/nmig/node_modules/pg/lib/client.js:341:10)
at Client._handleErrorMessage (/home/hz/NMIG/nmig/node_modules/pg/lib/client.js:352:12)
at Connection.emit (node:events:517:28)
at /home/hz/NMIG/nmig/node_modules/pg/lib/connection.js:117:12
at Parser.parse (/home/hz/NMIG/nmig/node_modules/pg-protocol/dist/parser.js:36:17)
at Socket. (/home/hz/NMIG/nmig/node_modules/pg-protocol/dist/index.js:11:42)
[... lines matching original stack trace ...]
at Readable.push (node:internal/streams/readable:278:10) {
length: 84,
severity: 'FATAL',
code: '57P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: '0',
dataType: 'BACKEND',
constraint: undefined,
file: undefined,
line: undefined,
routine: undefined
}

Node.js v18.19.1
--[populateTable] error: unterminated CSV quoted field

SQL: COPY "public"."tab_record_history" ("id","diff_full_text","modify_time","modify_user","old_full_text","std_id","record_status","para_id","before_paraid","modify_type","modify_para_content","task_step") FROM STDIN 
    WITH (FORMAT csv, DELIMITER ',', ENCODING 'UTF8');


--[populateTable] Error loading table data:

SELECT id AS id,REPLACE(diff_full_text, '', '') AS diff_full_text,IF(modify_time IN('0000-00-00', '0000-00-00 00:00:00'), '-INFINITY', CAST(modify_time AS CHAR)) AS modify_time,REPLACE(modify_user, '', '') AS modify_user,REPLACE(old_full_text, '', '') AS old_full_text,std_id AS std_id,record_status AS record_status,REPLACE(para_id, '', '') AS para_id,REPLACE(before_paraid, '', '') AS before_paraid,REPLACE(modify_type, '', '') AS modify_type,REPLACE(modify_para_content, '', '') AS modify_para_content,task_step AS task_step FROM tab_record_history;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions