Postgres には、次のようなテーブルがあります。
CREATE TABLE storehouse
(
user_id bigint NOT NULL,
capacity integer NOT NULL,
storehouse json NOT NULL,
last_modified timestamp without time zone NOT NULL,
CONSTRAINT storehouse_pkey PRIMARY KEY (user_id)
)
そしてstorehouse.storehouse
、次のようなデータを保存しています:
{
"slots":[
{
"slot" : 1,
"id" : 938
},
{
"slot" : 2,
"id" : 127
},
]
}
問題は、更新したいのですが、そのstorehouse.storehouse.slots[2]
方法がわかりません。
フィールド全体を変更する方法は知っていますstorehouse.storehouse
が、Postgres は型をサポートしているため、部分的な変更をサポートする必要があるのではないかと考えています。そうしないと、型と型json
に違いはありません。( type には とは異なる type validation があることも知っています)json
text
json
text