Services
24×7×365 Technical Support
Migration to PostgreSQL
High Availability Deployment
Database Audit
Remote DBA for PostgreSQL
Products
Postgres Pro Enterprise
Postgres Pro Standard
Cloud Solutions
Postgres Extensions
Resources
Blog
Documentation
Webinars
Videos
Presentations
Community
Events
Training Courses
Books
Demo Database
Mailing List Archives
About
Leadership team
Partners
Customers
In the News
Press Releases
Press Info
Services
24×7×365 Technical Support
Migration to PostgreSQL
High Availability Deployment
Database Audit
Remote DBA for PostgreSQL
Products
Postgres Pro Enterprise
Postgres Pro Standard
Cloud Solutions
Postgres Extensions
Resources
Blog
Documentation
Webinars
Videos
Presentations
Community
Events
Training Courses
Books
Demo Database
Mailing List Archives
About
Leadership team
Partners
Customers
In the News
Press Releases
Press Info
Facebook
Downloads
Home
>
mailing lists
[SQL] Updating jsonb rows - Mailing list pgsql-sql
From
Michael Moore
Subject
[SQL] Updating jsonb rows
Date
August 12, 2017
07:08:39
Msg-id
CACpWLjMwg7NaygNKkUzZObuH_tyKRkqfrGkSUVs7h2H4PjPRCw@mail.gmail.com
Whole thread
Raw
Responses
Re: [SQL] Updating jsonb rows
("David G. Johnston" <david.g.johnston@gmail.com>)
List
pgsql-sql
Tree view
this ...
DO
$BODY$
declare
j_final_rslt jsonb;
begin
select jsonb_agg(row_to_json(alias)) from
(select prompt_seq, attribute_name from tfinal_rslt limit 2) alias into j_final_rslt;
raise notice 'j_final_rslt BEFORE %',j_final_rslt;
select jsonb_set(j_final_rslt, '{0,prompt_seq}','99',true) into j_final_rslt;
raise notice 'j_final_rslt AFTER %',j_final_rslt;
end;
$BODY$
gives the result:
BEFORE [{"prompt_seq":
150
, "attribute_name": "InsuredTimeframe"}, {"prompt_seq": 1200, "attribute_name": "DriverOccupation"}]
AFTER [{"prompt_seq":
99
, "attribute_name": "InsuredTimeframe"}, {"prompt_seq": 1200, "attribute_name": "DriverOccupation"}]
How could I change this to ALSO change the attribute_name on the 2nd record to "ABC". The AFTER result would ideally look like:
AFTER [{"prompt_seq": 99, "attribute_name": "InsuredTimeframe"}, {"prompt_seq": 1200, "attribute_name": "ABC"}]
tia, Mike
pgsql-sql
by date:
Previous
From:
"David G. Johnston"
Date:
11 August 2017, 21:43:27
Subject:
Re: [SQL] Always getting back a row, even with no results
Next
From:
"David G. Johnston"
Date:
12 August 2017, 07:18:32
Subject:
Re: [SQL] Updating jsonb rows
Есть вопросы? Напишите нам!
Соглашаюсь с условиями обработки персональных данных
I confirm that I have read and accepted PostgresPro’s
Privacy Policy
.
I agree to get Postgres Pro discount offers and other marketing communications.
✖
×
×
Everywhere
Documentation
Mailing list
List:
all lists
pgsql-general
pgsql-hackers
buildfarm-members
pgadmin-hackers
pgadmin-support
pgsql-admin
pgsql-advocacy
pgsql-announce
pgsql-benchmarks
pgsql-bugs
pgsql-chat
pgsql-cluster-hackers
pgsql-committers
pgsql-cygwin
pgsql-docs
pgsql-hackers-pitr
pgsql-hackers-win32
pgsql-interfaces
pgsql-jdbc
pgsql-jobs
pgsql-novice
pgsql-odbc
pgsql-patches
pgsql-performance
pgsql-php
pgsql-pkg-debian
pgsql-pkg-yum
pgsql-ports
pgsql-rrreviewers
pgsql-ru-general
pgsql-sql
pgsql-students
pgsql-testers
pgsql-translators
pgsql-www
psycopg
Period
anytime
within last day
within last week
within last month
within last 6 months
within last year
Sort by
date
reverse date
rank
Services
24×7×365 Technical Support
Migration to PostgreSQL
High Availability Deployment
Database Audit
Remote DBA for PostgreSQL
Products
Postgres Pro Enterprise
Postgres Pro Standard
Cloud Solutions
Postgres Extensions
Resources
Blog
Documentation
Webinars
Videos
Presentations
Community
Events
Training Courses
Books
Demo Database
Mailing List Archives
About
Leadership team
Partners
Customers
In the News
Press Releases
Press Info
By continuing to browse this website, you agree to the use of cookies. Go to
Privacy Policy
.
I accept cookies