From 1a2983231d9080bfa06cfbf38d5415b5d71eea91 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Fri, 20 Sep 2019 20:18:11 -0300 Subject: Split out code into new getKeyJsonValueFromContainer() The new function stashes its output value in a JsonbValue that can be passed in by the caller, which enables some of them to pass stack-allocated structs -- saving palloc cycles. It also allows some callers that know they are handling a jsonb object to use this new jsonb object-specific API, instead of going through generic container findJsonbValueFromContainer. Author: Nikita Glukhov Discussion: https://postgr.es/m/7c417f90-f95f-247e-ba63-d95e39c0ad14@postgrespro.ru --- src/include/utils/jsonb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/include/utils/jsonb.h') diff --git a/src/include/utils/jsonb.h b/src/include/utils/jsonb.h index ac52b75f51d..35766e106a8 100644 --- a/src/include/utils/jsonb.h +++ b/src/include/utils/jsonb.h @@ -364,6 +364,9 @@ extern int compareJsonbContainers(JsonbContainer *a, JsonbContainer *b); extern JsonbValue *findJsonbValueFromContainer(JsonbContainer *sheader, uint32 flags, JsonbValue *key); +extern JsonbValue *getKeyJsonValueFromContainer(JsonbContainer *container, + const char *keyVal, int keyLen, + JsonbValue *res); extern JsonbValue *getIthJsonbValueFromContainer(JsonbContainer *sheader, uint32 i); extern JsonbValue *pushJsonbValue(JsonbParseState **pstate, -- cgit v1.2.3