Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #818

Re: Update Json column

Newsgroups comp.databases.postgresql
Date 2018-03-09 21:07 -0800
References (4 earlier) <23a909c9-9a4e-462a-89fa-a1efda4fb198@googlegroups.com> <efaf09da-16e0-48ff-b4eb-5401cd6be4cd@googlegroups.com> <p7o5gf$g10$1@dont-email.me> <0b7cb08d-f57c-4d94-8da7-5878edd0f090@googlegroups.com> <p7r77m$snp$1@dont-email.me>
Message-ID <83cb552b-4cff-4f76-b9c9-49bf26b297c9@googlegroups.com> (permalink)
Subject Re: Update Json column
From forough m <fmirkarimzade@gmail.com>

Show all headers | View raw


On Thursday, March 8, 2018 at 3:06:23 PM UTC+3:30, Laurenz Albe wrote:
> On Wed, 07 Mar 2018 00:09:05 -0800, forough m wrote:
> >> You could use CASE:
> >> 
> >> UPDATE t SET j = CASE WHEN <j contains key>
> >>                       THEN <j with 3 added>
> >>                       ELSE <j with new key>
> >>                  END
> > 
> > Wow, very good. thank you. How should i check <j contains key> ?
> 
> Hm. Why don't you look at the documentation, section
> "JSON functions and operators":
> 
> https://www.postgresql.org/docs/current/static/functions-
> json.html#FUNCTIONS-JSONB-OP-TABLE
> 
> @> is right there.

Sure, thanks :)

Back to comp.databases.postgresql | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Update Json column forough m <fmirkarimzade@gmail.com> - 2018-02-26 22:09 -0800
  Re: Update Json column Laurenz Albe <laurenz@nospam.pn> - 2018-02-27 13:04 +0000
    Re: Update Json column forough m <fmirkarimzade@gmail.com> - 2018-02-28 03:06 -0800
    Re: Update Json column forough m <fmirkarimzade@gmail.com> - 2018-02-28 03:21 -0800
      Re: Update Json column Laurenz Albe <laurenz@nospam.pn> - 2018-03-01 10:18 +0000
        Re: Update Json column forough m <fmirkarimzade@gmail.com> - 2018-03-05 01:44 -0800
          Re: Update Json column forough m <fmirkarimzade@gmail.com> - 2018-03-06 07:47 -0800
            Re: Update Json column Laurenz Albe <laurenz@nospam.pn> - 2018-03-07 07:48 +0000
              Re: Update Json column forough m <fmirkarimzade@gmail.com> - 2018-03-07 00:09 -0800
                Re: Update Json column Laurenz Albe <laurenz@nospam.pn> - 2018-03-08 11:36 +0000
                Re: Update Json column forough m <fmirkarimzade@gmail.com> - 2018-03-09 21:07 -0800
              Re: Update Json column forough m <fmirkarimzade@gmail.com> - 2018-03-07 00:10 -0800

csiph-web