This query gets syntax error:
var querydb = `INSERT INTO msg_conversations VALUES (DEFAULT, ${user_id}, null, null, null, null, '{"key": "value", "unique": "' || uuid_generate_v4() || '"}'::jsonb, to_timestamp('05 Dec 2000', 'DD Mon YYYY'), to_timestamp('05 Dec 2000', 'DD Mon YYYY') )`
db.sequelize.query(querydb)
first convert to text then convert to jsonb
train this tips by select statemant:
select ('{"key": "value", "unique": "asdas'||to_timestamp( '05 Dec 2000', 'DD Mon YYYY' )||'"}' ::TEXT)::jsonb
||
only use for text type
then for your problem :
var querydb = `INSERT INTO msg_conversations VALUES (DEFAULT, ${user_id}, null, null, null, null, ('{"key": "value", "unique": "' || uuid_generate_v4() || '"}'::TEXT)::jsonb, to_timestamp('05 Dec 2000', 'DD Mon YYYY'), to_timestamp('05 Dec 2000', 'DD Mon YYYY') )`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With