This causes a parse error in my sql query. Consider the following example:
CREATE TABLE thing(
tags string[] NOT NULL
)
const format = require('pg-format')
format('INSERT INTO %I (%I) VALUES(%L)', 'thing', 'tags', [])
Now this get's formatted into the following query:
INSERT INTO thing (tags) VALUES()
Which gives the following error:
error: syntax error at or near ")"
I believe that the correct query output would have been:
INSERT INTO thing (tags) VALUES('{}')
A workaround is to send in the string '{}' to the format function, but that is very ugly and breaks my validation of data since it expects an array of strings...
This causes a parse error in my sql query. Consider the following example:
Now this get's formatted into the following query:
Which gives the following error:
I believe that the correct query output would have been:
A workaround is to send in the string
'{}'to the format function, but that is very ugly and breaks my validation of data since it expects an array of strings...