I need to perform something like this:
pg.query(`insert into tbl (field1, field2) values($1, $2)`, ["a", "(select id from another_table limit 1)"])
this causes the following error
error: invalid input syntax for type uuid: "(select id from another_table limit 1)"
INSERT INTO tbl (field1, field2) SELECT $1, id FROM another_table LIMIT 1;. This also fixes the other syntax error in your SQL, the comma right before, values(.node-postgres? @FrankHeikenspg.query(INSERT INTO tbl (field1, field2) values ($1, $2), ["'a'", "SELECT $1, id FROM another_table LIMIT 1"])note that the subquery is not wrapped by single quoyes