Skip to content

Instantly share code, notes, and snippets.

@PythonDevOp
Last active October 7, 2016 18:42
Show Gist options
  • Save PythonDevOp/f7a7f95fd7fa11a06420c54c5be4501a to your computer and use it in GitHub Desktop.
Save PythonDevOp/f7a7f95fd7fa11a06420c54c5be4501a to your computer and use it in GitHub Desktop.
Function Call, Data, Errors
//////// Function Call
pgQuery(`SELECT update_table_func ($1)`,
[chartProperties], function(err, results){
if(err){
console.log("error .........>", err);
return callback (err);
}
callback(null, results.rows[0]);
});
//////// Data Passed into the $1 Variable
'[{"chart_id":1,"chart_x":4,"chart_y":4,"chart_row":4,"chart_col":4},{"chart_id":2,"chart_x":3,"chart_y":3,"chart_row":3,"chart_col":3}]'
//////// Error returned from postgres in Node console
error .........> { [error: invalid input syntax for type json]
name: 'error',
length: 217,
severity: 'ERROR',
code: '22P02',
detail: 'Expected ":", but found ",".',
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: 'JSON data, line 1: ..."chart_y\\":2,\\"chart_row\\":0,\\"chart_col\\":0}",...',
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'src\\backend\\utils\\adt\\json.c',
line: '1140',
routine: 'report_parse_error' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment