Accessing parameters of a prepared query inside an FDW - Mailing list pgsql-general

From Adam Fletcher
Subject Accessing parameters of a prepared query inside an FDW
Date
Msg-id CAMfJBeBsF2=Q0wdnixRJ4Rm35moJPc3Cbq=SU_wLJn9ifbV6Vw@mail.gmail.com
Whole thread Raw
Responses Re: Accessing parameters of a prepared query inside an FDW
List pgsql-general
Hi Folks,

Is it possible to get the parameterized prepared query inside an FDW such that it can be prepared/bind'd/execute'd on the receiving end of the FDW?

For example, if I `PREPARE stmt(int) AS SELECT * from fdwrapped_tbl where pk = $1;` then `execute stmt(1);` I want my FDW be aware that the query was prepared.

Right now, if given the above, and I walk through the postgres_fdw code and output the parse tree from root->parse->query (the PlannerInfo node), I see no PARAM nodes - inside the OPEXPR is just the VAR & CONST (in this case, the CONST is 1). Note that if I call ereport() I do see the correct prepared statement (eg, with the $1) in the output (as debug_query_string has that statement in it). 

I cannot find an example of an FDW that supports passing on prepared statements.  Any help appreciated!

-Adam

pgsql-general by date:

Previous
From: Hannes Erven
Date:
Subject: RowLock and multiple transactions
Next
From: "David G. Johnston"
Date:
Subject: Re: Accessing parameters of a prepared query inside an FDW