Closed
Description
When your column is type json and you try and insert a JSON array, you get the following error:
{ [error: invalid input syntax for type json]
length: 154,
name: 'error',
severity: 'ERROR',
code: '22P02',
detail: 'Expected string or "}", but found "1".',
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: 'JSON data, line 1: {1...',
file: 'json.c',
line: '665',
routine: 'report_parse_error' }
For example, this works in PSQL:
insert into my_table ( data ) values ( '[1,2,3]' );
But this returns an error in node-pg:
client.query('insert into my_table ( data ) values ( $1 )', [ [1,2,3] ], function( error ){
/* ERROR */
});
Metadata
Metadata
Assignees
Labels
No labels