A small praise for JSONB

From: Marcin Cieslak <saper(at)saper(dot)info>
To: pgsql-advocacy(at)postgresql(dot)org
Subject: A small praise for JSONB
Date: 2018-05-10 17:13:36
Message-ID: nycvar.OFS.7.76.6.1805101710100.2691@z.fncre.vasb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy

This is referring to that the ActivityPub
implementation Pleroma (https://pleroma.social/)
is using JSONB practically for everything
in a very simple schema.

https://bidule.menf.in/notice/42923

Alice
@alice(at)bidule(dot)menf(dot)in

Oooh I love postgresql's jsonb type !
I accidently set the background image
for my pleroma account and didn't find
a way to delete it in the interface.
So I searched a bit in the database and
quickly found that the column users.info
contained it (quite easy).

At first, I didn't know about jsonb,
so I thought it was a string and I was
in for a painful REGEXP_REPLACE to
remove the "background" property of
the object. Then the psql interpreter
complained about my trying to use
REGEXP_REPLACE on a jsonb value, I read
about it and realised my UPDATE would be
as simple as :

UPDATE users SET info = info -
'background' WHERE id = 1;

(that's right, my id is 1, that's what
you get for opening your own instance
?

May 10, 2018, 18:59 · 1 · 0

--
Marcin

Browse pgsql-advocacy by date

  From Date Subject
Next Message Mark Wong 2018-05-23 22:05:40 Re: OSCON 2017 Booth application
Previous Message Guillaume Lelarge 2018-05-02 09:12:19 [PROPOSAL] Interested in translating the french book "PostgreSQL: Architecture et notions avancée" into English?