0
votes

I using pg node module to connect to PostgreSQL, and I am trying to execute this query:

  const res = await client.query(`SELECT number_transactions FROM transaction.city_unique_dates WHERE date_day_timestamp = TIMESTAMP '$1:value-$2:value-$3:value'`, 
  ['2014', '04', '12'])
  console.log(res)

But I am getting the following error:

error: invalid input syntax for type timestamp: "$1:value-$2:value-$3:value"

Does anyone have an idea what's going wrong with timestamp ? I am familiar with Node.js but less familiar with postgres

https://node-postgres.com/

1

1 Answers

0
votes

You have to try this:

const res = await client.query(`SELECT number_transactions FROM 
transaction.city_unique_dates WHERE date_day_timestamp = TIMESTAMP("2014-04-12")`)
console.log(res)