PostreSQL insert statement with HSTORE value
Opened this issue · 1 comments
rubymaniac commented
I am trying to create a query like this:
INSERT INTO hstore_test (data) VALUES ('"key1"=>"value1", "key2"=>"value2", "key3"=>"value3"')
Is there any way I can do this using node-sql?
Thanks!
whitelynx commented
That's supported by the Table#insert()
function:
hstore_test.insert({data: '"key1"=>"value1", "key2"=>"value2", "key3"=>"value3"'})
// results in:
// { text: 'INSERT INTO "hstore_test" ("data") VALUES ($1)',
// values: [ '"key1"=>"value1", "key2"=>"value2", "key3"=>"value3"' ] }
See test/dialects/insert-tests.js
for more examples.