Re: Wanted: jsonb on-disk representation documentation
От | Heikki Linnakangas |
---|---|
Тема | Re: Wanted: jsonb on-disk representation documentation |
Дата | |
Msg-id | 536A125B.2090005@vmware.com обсуждение исходный текст |
Ответ на | Re: Wanted: jsonb on-disk representation documentation (Heikki Linnakangas <hlinnakangas@vmware.com>) |
Ответы |
Re: Wanted: jsonb on-disk representation documentation
|
Список | pgsql-hackers |
Continuing the review, I don't like the "superheader" terminology. To me, "super" implies that there's some other kind of header involved, and the superheader somehow includes or the parent of that. But it actually seems to refer to the header field in the beginning of an array or object value. In essence, "superheader" is used as the common term to refer to an object that can be an array or an object. I propose that we change that to "container". Noticed something funny while looking at the convertJsonb function: postgres=# select substr(((('["' ||repeat('x', 268435455) || '", "' || repeat('y', 2) || '"]')::jsonb)::text), 268435455); substr ------------------------------------------------------------------------------ ----------------------------------------------------------- xxx", 0.000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000] (1 row) Somehow the second string element in the array, "yy", gets turned into a numeric. The reason is that although we check that the length of a single string doesn't exceed the maximum of 2^28 that can be stored in the space reserved for the length in a Jentry, there are no length checks for the end offset stored there in an array. So if the total size of elements in an array exceed 2^28, funny things like above happen. Attached is a WIP patch that fixes the above, renames "superheader" to "container", and includes the refactorings and cleanup that I posted earlier today. - Heikki
Вложения
В списке pgsql-hackers по дате отправления: