New to Postgres, just wondering how the syntax would be like. For example, I have the following table:
CREATE TABLE test
(
field1 hstore[],
field2 text[],
field3 hstore
)
...
For inserting arrays, syntax is like
INSERT INTO test (field2) VALUES (' {"abc","def"} ');
and for inserting hstore, syntax is like
INSERT INTO test (field3) VALUES (' "a"=>1.0, "b"=>2.4 ');
but,,, for insertions on 'field1', what do I do? Something like below gives me errors:
INSERT INTO test (field1)
VALUES (`{'"a"=>1.0, "b"=>2.0', '"a"=>3.0, "b"=>4.0' }`)
Any fixes? Thanks!
==EDIT==
Just figured it out.
INSERT INTO test (field1)
VALUES ('{"a=>1.0, b=>2.0", "a=>3.0, b=>4.0"}' )
The answer below helps as well, but in this particular case, a string(instead of an Array structure) works better with my existing code.