473,396 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

1
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 10205
zmbd
5,501 Expert Mod 4TB
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
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
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
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
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
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
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
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
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
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
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.