Composite types as parameters

From: Elijah Stone <elronnd(at)elronnd(dot)net>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Composite types as parameters
Date: 2021-06-26 07:10:39
Message-ID: 63c1207e-5537-3815-aa9c-47507943b083@elronnd.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello all,

I am trying to add support for composite types to my ORM, which uses libpq
and the binary format.

Given a schema like this one:

create type composite as (...);
create table sometable (field composite, ...);

I want to execute a query like this:

PQexecParams("insert into sometable values($1, ...);", paramValues[0] = serialize some record, ...)

However this fails in coerce_record_to_complex(), because it receives a
node of type Param, but it can only handle RowExpr and Var. There is a
comment suggesting that this is not a fundamental limitation, but (not
being familiar with postgres codebase) I'm not sure how to go about fixing
it. I assume there is a mapping somewhere from param ids to objects, but
am unable to find it.

Does anyone have any pointers or suggestions? Am I going about this in
entirely the wrong way?

-E

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2021-06-26 07:15:48 Re: seawasp failing, maybe in glibc allocator
Previous Message Fabien COELHO 2021-06-26 06:47:34 Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench