From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Wyatt Alt <wyatt(dot)alt(at)gmail(dot)com> |
Cc: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: why are null bytes allowed in JSON columns? |
Date: | 2023-09-22 01:53:17 |
Message-ID: | CAKFQuwawwHJsahVL60=uRnMnc0O_DK4z-yfKLaA5SPmqv0HGcA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thursday, September 21, 2023, Wyatt Alt <wyatt(dot)alt(at)gmail(dot)com> wrote:
>
>
> I am not sure if this is a bug or a known inconvenience.
>
>
It’s a reason to not use json in new development and instead use jsonb.
>
> Once the null byte is inserted the JSON operator ->> can no longer be
> applied to the column. JSONB columns don't allow null bytes at all. Should
> the same constraint apply on JSON? If not, applications must be vigilant to
> guard against null bytes, or queries could break at read time. My reading
> of table 8.23 in https://www.postgresql.org/docs/16/datatype-json.html is
> they should be disallowed at insert.
>
That table basically describes how jsonb behaves, not json. I agree that
fact could be made clearer instead of having to deduce that from reading
the prose which explicitly says json is basically lacks safeties for any
usage within the database. But it also imposes fewer restrictions in
exchange.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2023-09-22 01:55:09 | Re: BUG #18124: PG16 release note document bug in "Add build option to allow testing of small WAL segment sizes" |
Previous Message | Bruce Momjian | 2023-09-22 01:47:39 | Re: BUG #18124: PG16 release note document bug in "Add build option to allow testing of small WAL segment sizes" |