+static void
+recvJsonbValue(StringInfo buf, JsonbValue *v, uint32 level, int c)
+ v->size = sizeof(JEntry) * 2 + VARSIZE_ANY(v->numeric);
What's the *2 here?
Reservation for aligment. It's allowed to be v->size greater than it's actually
needed. Fixed.
This function and recvJsonbValue call each other recursively, afaics
without any limit, shouldn't they check for the stack depth?
added a check_stack_depth()
*3?
Jentry + header + reservation for aligment
+ v->hash.pairs = palloc(sizeof(*v->hash.pairs) *
v->hash.npairs);
+
if (v->hash.npairs > (buf->len - buf->cursor) / (2 * sizeof(uint32)))
ereport(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE)
2 * sizeof(uint32) - minimal size of object element (key plus its value)
Shouldn't that be an ereport(ERRCODE_DATATYPE_MISMATCH)? Similar in a
few other places.
fixed
+char *
+JsonbToCString(StringInfo out, char *in, int estimated_len)
Such a behaviour certainly deserves a documentary comment. Generally
some more functions could use that.
add comment
+ while ((type = JsonbIteratorGet(&it, &v, false)) != 0)
+reout:
+ goto reout;
Hrmpf.
:) commented
+Datum
+jsonb_typeof(PG_FUNCTION_ARGS)
+{
...
+}
Hm, shouldn't that be in jsonfuncs.c?
No idea, i don't have an objection
send/recv for hstore is fixed too. Should I make new version of patch? Right now
it's placed on github. May be Andrew wants to change something?
--
Teodor Sigaev E-mail: teo...@sigaev.ru
WWW: http://www.sigaev.ru/
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers