proposal: allow to specify result tupdesc and mode in SPI API

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема proposal: allow to specify result tupdesc and mode in SPI API
Дата
Msg-id CAFj8pRAgboSSD-W1gKg3jKVV7s1Zhvf8==gm5+PV6ndR34v-bQ@mail.gmail.com
обсуждение исходный текст
Список pgsql-hackers
Hello

we have not possibility to simple specify result types in SPI API functions. Planner has this functionality - see transformInsertRow function, but it is not visible from SPI.

A new function should to look like:



SPIPlanPtr
SPI_prepare_params_rettupdesc(const char *src,
                                   ParserSetupHook parserSetup,
                                   void *parserSetupArg,
                                   int cursorOptions,
                                   TupDesc *retTupDesc,
                                   int CoercionMode)


CoercionMode should be:

COERCION_MODE_SQL  .. same as INSERT or UPDATE does
COERCION_MODE_SQL_NOERROR .. same as above with possible IO cast
COERCION_MODE_EXPLICIT .. same as using explicit casting
COERCION_MODE_EXPLICIT_NOERROR .. same as previous with possible IO cast

Benefits:

* simplify life to SPI users - no necessary late casting

* possible small simplification of plpgsql with two benefits:

  ** reduce performance impact of hidden IO cast

  ** reduce possible issues with type transformation via hidden IO cast

Comments, notes?

Regards

Pavel Stehule

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

Предыдущее
От: Noah Misch
Дата:
Сообщение: Re: strncpy is not a safe version of strcpy
Следующее
От: Etsuro Fujita
Дата:
Сообщение: Compute attr_needed for child relations (was Re: inherit support for foreign tables)