Teach add_json() that jsonb is of TYPCATEGORY_JSON.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 9 May 2014 13:44:11 +0000 (09:44 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 9 May 2014 13:44:11 +0000 (09:44 -0400)
This code really needs to be refactored so that there aren't so many copies
that can diverge.  Not to mention that this whole approach is probably
wrong.  But for the moment I'll just stick my finger in the dike.
Per report from Michael Paquier.

src/backend/utils/adt/json.c

index e2db24520eb0f2c835ab512a53cccec7a82c65a2..22ef4026b7e4ee6a732f37a74dd491fa8cc0fd46 100644 (file)
@@ -1562,7 +1562,7 @@ add_json(Datum val, bool is_null, StringInfo result, Oid val_type, bool key_scal
                tcategory = TYPCATEGORY_ARRAY;
        else if (val_type == RECORDOID)
                tcategory = TYPCATEGORY_COMPOSITE;
-       else if (val_type == JSONOID)
+       else if (val_type == JSONOID || val_type == JSONBOID)
                tcategory = TYPCATEGORY_JSON;
        else
                tcategory = TypeCategory(val_type);