PostgresのHStoreデータ型にネストされたハッシュを含めることができるかどうかさえわかりません。可能な場合は、それらを挿入する方法を教えてください。
これが私がこれまでに試したことです:
-- Database: test1
-- DROP DATABASE test1;
/*
CREATE DATABASE test1
WITH OWNER = iainuser
ENCODING = 'UTF8'
TABLESPACE = pg_default
LC_COLLATE = 'en_GB.UTF-8'
LC_CTYPE = 'en_GB.UTF-8'
CONNECTION LIMIT = -1;
*/
/* create extension hstore; */
/*drop table my_store;*/
/*
create table my_store (
id serial primary key not null,
doc hstore
);
CREATE INDEX my_store_doc_idx_gist
ON my_store
USING gist
(doc);
*/
/* select doc from my_store; */
/*
insert into my_store (doc) values ( '"a" => "1"' );
select doc -> 'a' as first_key from my_store; -- returns "1"
*/
/* insert into my_store (doc) values ( '"b" => "c" => "3"' ); -- doesn't work */
/* insert into my_store (doc) values ( '"b" => ("c" => "3")' ); -- doesn't work */
/* insert into my_store (doc) values ( '"b" => hstore("c" => "3")' ); -- doesn't work */
/* insert into my_store (doc) values ( '"b"' => hstore("c" => "3")' ); -- doesn't work */
/* insert into my_store (doc) values ( "b"=>'"c"=>"3"'::hstore ); -- doesn't work */
それが不可能な場合、ネストされたハッシュを操作するための現在受け入れられている標準/イディオムはありますか?おそらくそれらを引き離し、IDを使用してそれらを参照しますか?
これに関する助けをいただければ幸いです。