legacy assumptions

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: jonathan(at)buhacoff(dot)net
Subject: legacy assumptions
Date: 2019-11-25 17:47:09
Message-ID: 157470402952.7229.3931536721568065202@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/datatype-json.html
Description:

I'm wondering if this one line of section 8.14 JSON Types
(https://www.postgresql.org/docs/current/datatype-json.html) can be edited
to remove the word "legacy":

"In general, most applications should prefer to store JSON data as jsonb,
unless there are quite specialized needs, such as legacy assumptions about
ordering of object keys."

I'm concerned that with the word "legacy" there, someone might come along
eventually and decide the json column type isn't needed anymore because it's
"legacy", where in fact there are modern and legitimate uses for a field
that allows you to retrieve the data exactly as it was stored and allows
JSON queries on that data (even if they are slower).

In my application, there's a database table to store encrypted and
integrity-protected information. The ciphertext is in a binary data column,
the ciphertext metadata is in a jsonb column, and integrity-protected
plaintext is in a json column. The integrity protection is implemented as
either the AD portion of AES-GCM AEAD or as a separately-computed HMAC;
either way the bytes must be read exactly as they were stored or the
integrity check will fail. Being able to select records based on the content
of that plaintext json data is nice. An alternative would be to store the
plaintext as binary data for the integrity check and have a separate jsonb
column with a second copy of the same data. Since different applications
have different time/space tradeoffs, it's good to have the choice.

My suggestion for that sentence:

"In general, most applications should prefer to store JSON data as jsonb,
unless there are quite specialized needs, such as assumptions about ordering
of object keys or the need to retrieve the data exactly as it was stored."

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Jonathan S. Katz 2019-11-26 00:28:43 Re: legacy assumptions
Previous Message Tom Lane 2019-11-25 15:16:59 Re: Add <caution> for ALTER TEXT SEARCH CONFIGURATION