Re: Composite types as parameters - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Composite types as parameters
Date
Msg-id 3013946.1624722123@sss.pgh.pa.us
Whole thread Raw
In response to Composite types as parameters  (Elijah Stone <elronnd@elronnd.net>)
Responses Re: Composite types as parameters
List pgsql-hackers
Elijah Stone <elronnd@elronnd.net> writes:
> 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.

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.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Re: Using each rel as both outer and inner for JOIN_ANTI
Next
From: Arne Roland
Date:
Subject: Re: PATCH: generate fractional cheapest paths in generate_orderedappend_path