From b697b8b752ccbe86930c84e76cdffd832adf453d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB?= Date: Sat, 28 Dec 2024 12:22:04 +0300 Subject: [PATCH] Restore Attinmeta (by original rel, not RETURNING) --- sqlite_fdw.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sqlite_fdw.c b/sqlite_fdw.c index 8214486c..f19281b1 100644 --- a/sqlite_fdw.c +++ b/sqlite_fdw.c @@ -1858,6 +1858,7 @@ sqliteBeginForeignModify(ModifyTableState *mtstate, SqliteFdwExecState *fmstate = NULL; EState *estate = mtstate->ps.state; Relation rel = resultRelInfo->ri_RelationDesc; + TupleDesc tupdesc = RelationGetDescr(rel); AttrNumber n_params = 0; Oid typefnoid = InvalidOid; bool isvarlena = false; @@ -1906,6 +1907,10 @@ sqliteBeginForeignModify(ModifyTableState *mtstate, ALLOCSET_SMALL_INITSIZE, ALLOCSET_SMALL_MAXSIZE); + /* Prepare for input conversion of RETURNING results. */ + if (fmstate->has_returning) + fmstate->attinmeta = TupleDescGetAttInMetadata(tupdesc); + /* Set up for remaining transmittable parameters */ foreach(lc, fmstate->retrieved_attrs) { @@ -5425,7 +5430,7 @@ sqlite_store_returning_result(SqliteFdwExecState *fmstate, { if (SQLITE_ROW == rc ) { - /* + TupleDesc tupleDescriptor = tupleSlot->tts_tupleDescriptor; make_tuple_from_result_row(fmstate->stmt, tupleDescriptor, @@ -5434,7 +5439,7 @@ sqlite_store_returning_result(SqliteFdwExecState *fmstate, tupleSlot->tts_isnull, fmstate->rel, fmstate->attinmeta, - NULL); + NULL);/* ereport(WARNING, (errcode(ERRCODE_FDW_UNABLE_TO_CREATE_EXECUTION), errmsg("row"))); */ }