I have a table of orders:
postgres=# \d orders
Table "public.orders"
Column | Type | Modifiers
--------------------+-----------------------------+-------------------------------------
id | uuid | not null default uuid_generate_v4()
production_details | jsonb |
My production_details are represented as follows:
postgres=# SELECT production_details FROM orders;
{
"data":[
{
"id":"1a24586c-c917-45d0-93d9-2d969fa6959d",
"quantity":10,
"production_at":"2016-04-17T00:00:00.000+00:00"
},
...
]
}
And for each production_detail I'd like to change timestamp to just date.
I know I can select all production_at as:
SELECT (jsonb_array_elements(production_details->'data')->>'production_at') FROM orders;
However, how to update such JSON?