wren-engine icon indicating copy to clipboard operation
wren-engine copied to clipboard

`node-postgres` can't pass prepared statement parameters for LIMIT or OFFSET for BigQuery

Open goldmedal opened this issue 2 years ago • 0 comments

node-postgres will pass all parameter as a VARCHAR data, no matter what type you input.

client.connect()
  .then(() => {
    const query = {
      text: 'SELECT * FROM Model_Ticket LIMIT $1 OFFSET $2',
      values: [100, 50],
    };
    return client.query(query);
  })

However, BigQuery only accepts INTEGER literal for LIMIT or OFFSET statement.

  "message" : "LIMIT expects an integer literal or parameter at [139:7]",
  "status" : "INVALID_ARGUMENT"

goldmedal avatar Jan 11 '24 06:01 goldmedal