473,489 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to update properties value in the array of jsonb field?

1 New Member
Q: How to update properties value in the array of jsonb field?

Hi All,

I run Postgres13 (PostgreSQL 13.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit)

I have a jsonb field type (fieldname is test), like below JSON array format, how to update is_read properties in extras node to true where the users_pid=1 and is_read = false?
Expand|Select|Wrap|Line Numbers
  1. [
  2.  {
  3.    "data": {
  4.    "users_pid": 1,
  5.    "datetime": "2022-05-01 13:10:58",
  6.    "extras": {
  7.      "is_read": false,
  8.      "read_dt": ""
  9.     }
  10.    }
  11.  },
  12.   {
  13.     "data": {
  14.     "users_pid": 3,
  15.     "datetime": "2022-05-23 11:03:22",
  16.     "extras": {
  17.        "is_read": false,
  18.        "read_dt": ""
  19.      }
  20.    }
  21.  },
  22.  {
  23.    "data": {
  24.      "users_pid": 1,
  25.      "datetime": "2022-05-13 11:23:22",
  26.      "extras": {
  27.      "is_read": false,
  28.      "read_dt": ""
  29.     }
  30.   }
  31.  }
  32. ]
May 24 '22 #1
1 10239
zmbd
5,501 Recognized Expert Moderator Expert
Hello Don2 - Welcome to Bytes...
You haven't included any steps that you've already tried - sort of a pre-requisite that you show what you've already tried along with any errors etc... that will help our experts to put you on the right path - without reinventing the wheel...

Without that information - it makes people feel like they're being used as an unpaid coding service instead of a friend lending a helping hand.
May 25 '22 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1624
by: SAN CAZIANO | last post by:
is there a function that get the name of the first input field of the current form ? in my example below I want create an array of form field name and in the onsubmit assign all element's name to...
4
2280
by: Won Mee | last post by:
I want to enter a value in a field and for that value that was entered to be multiplyed by 10 and then stored in a table. How do I do this? For example: =*10; Thanks, Won Mee
4
2244
by: erick-flores | last post by:
Hello I am trying to setup a default value for a field in a form. The field is a text box. I need to setup the default value to: 0.000. And whenever the user is trying to enter a value for this...
17
3998
by: The Frog | last post by:
Hello everyone, I am working on an application that can build database objects in MS Access from text files. I suppose you could call it a backup and restore type routine. Accessing the...
5
1256
by: Steve | last post by:
I have a table that looks like: A B C D New 2 5 3 B 1 7 11 A 6 9 13 C For each record I want to update the New field to the value in the field shown in...
2
1132
by: kathnicole | last post by:
Hi i have a table called tblStock consisting of Avaialble Stock for our company. i need to update the Stocks whenever we receive new goods. I have another table called tblStockInfo about received...
3
1628
by: BL3WC | last post by:
Hi, I encountered an error "Object not supporting this properties or method" while trying to set a checkbox value to 'True" in a loop. The VBA code I use is as follow: Set a value to intcount...
4
4273
by: nedryerson | last post by:
Hi, I'm trying to get a certain field to appear only when a value from another combobox field is selected. Specifically, when "Sample Rejected" is selected in the field "PcrLabResults," I would...
1
2729
by: Ryno Bower | last post by:
Hi I am trying to update a field in one table by the total sum value of a field in another table. This value is in currency format. I get error messages when trying to use e.g. Amount =...
1
992
by: Ferguslang | last post by:
Hi I am trying to find a solution to the problem I wish to be able to update a particular fields depending on the value =month(date()). I wish user to input hours worked that month on future...
0
7108
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7142
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
272
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.