How to append 2 default values to a JSONB column in Postgres SQL 14?
0
votes
1
answer
206
views
Previously I had 4 default values for a jsonb column in my table cities.
create_table "cities", force: :cascade do |t| t.jsonb "config", default: {"A"=>5, "B"=>7, "C"=>10, "D"=>10} Now I want to add 2 more default values
create_table "cities", force: :cascade do |t| t.jsonb "config", default: {"A"=>5, "B"=>7, "C"=>10, "D"=>10} Now I want to add 2 more default values
"E"=10
and "F"=0
to this column without changing the values of A,B,C and D. Note that the values of A,B,C and D have been updated differently for different cities. So I just want to append the default values of E and F to the column without changing the existing ones of A,B,C and D.
I cant't quite figure out the UPDATE query for this. I am quite new to this so its a little confusing. Thanks in advance for your help.
Asked by Priyanshu0007
(1 rep)
Dec 13, 2022, 06:07 AM
Last activity: Jun 29, 2025, 10:07 PM
Last activity: Jun 29, 2025, 10:07 PM