Re: Composite types as parameters

Поиск
Список
Период
Сортировка
От Elijah Stone
Тема Re: Composite types as parameters
Дата
Msg-id 363ec928-b0b8-c1eb-2f88-47d43c18ba7@elronnd.net
обсуждение исходный текст
Ответ на Re: Composite types as parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Composite types as parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sat, 26 Jun 2021, Tom Lane wrote:
> You probably would have better results from specifying the composite 
> type explicitly in the query:
>
> PQexecParams("insert into sometable values($1::composite, ...);",
>
> I gather from the complaint that you're currently doing something that 
> causes the Param to be typed as a generic "record", which is problematic 
> since the record's details are not available from anyplace.  But if you 
> cast it directly to a named composite type, that should work.
>
> If it still doesn't work, please provide a more concrete example.

Thanks, unfortunately adding the explicit cast doesn't help.  I've 
attached a minimal runnable example.

I am serializing as a generic record, so it occurs to me that another 
solution would be to use the actual type of the composite in question. 
(Though it also seems to me that my code should work as-is.)  Is there a 
way to discover the OID of a composite type?  And is the wire format the 
same as for a generic record?

  -E
Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: [PATCH] Make jsonapi usable from libpq
Следующее
От: Julien Rouhaud
Дата:
Сообщение: Re: [HACKERS] Preserving param location