Re: [BUGS] BUG #14849: jsonb_build_object doesn't like VARIADIC callsvery much

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [BUGS] BUG #14849: jsonb_build_object doesn't like VARIADIC callsvery much
Дата
Msg-id CAB7nPqRqcqnyBQDKi_v+bMGwq8UjPKVNzUAesK0b5Q_LJRewiw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [BUGS] BUG #14849: jsonb_build_object doesn't like VARIADIC calls very much  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [BUGS] BUG #14849: jsonb_build_object doesn't like VARIADIC callsvery much  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-bugs
On Mon, Oct 23, 2017 at 6:11 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> This comment is neither correct nor intelligible:
>
>         /* important for value, key cannot being NULL */
>
> I'd say just drop it.

Yep.

> The checks for "could not determine data type" errors seem
> rather duplicative, too.

Yep.

> <compulsive-neatnik-ism>
> The extern declaration seems to have been dropped in a rather
> random place in the .h file.
> </compulsive-neatnik-ism>

funcapi.h/c are nicely documented. I think that more is needed.

> Looks good otherwise.

My set of diffs for funcapi.h are actually that: * funcapi.h *   Definitions for functions which return composite type
and/orsets
 
+ *   or work on VARIADIC inputs.
[...]
+/*----------
+ * Support to ease writing of functions dealing with VARIADIC inputs
+ *----------
+ *
+ * This function extracts a set of argument values, types and NULL markers
+ * for a given input function. This returns a set of data:
+ * - **values includes the set of Datum values extracted.
+ * - **types the data type OID for each element.
+ * - **nulls tracks if an element is NULL.
+ *
+ * convert_unknown set to true enforces conversion of unknown input type
+ * unknown to text.
+ * variadic_start tracks the argument number of the function call where the
+ * VARIADIC set of arguments begins.
+ *
+ * The return result is the number of elements stored. In the event of a
+ * NULL input, then the caller of this function ought to generate a NULL
+ * object as final result, and in this case a result value of -1 is used
+ * to be able to make the difference between an empty array or object.
+ */
+extern int extract_variadic_args(FunctionCallInfo fcinfo, int variadic_start,
+                                bool convert_unknown, Datum **values,
Oid **types,
+                                bool **nulls);

Got this bit as well: * funcapi.c *   Utility and convenience functions for fmgr functions that return
- *   sets and/or composite types.
+ *   sets and/or composite types, or deal with VARIADIC inputs. *
-- 
Michael


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] BUG #14849: jsonb_build_object doesn't like VARIADIC calls very much
Следующее
От: gomer94@yandex.ru
Дата:
Сообщение: [BUGS] BUG #14866: The generated constraint in the typed table causes theserver to crash