diff --git a/expected/13.15/extra/returning.out b/expected/13.15/extra/returning.out index 6f7f74f9..b9333731 100644 --- a/expected/13.15/extra/returning.out +++ b/expected/13.15/extra/returning.out @@ -523,26 +523,30 @@ INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020. --Testcase 72: INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING ti c_timestamp; -ERROR: SQLite value is not compatible with PostgreSQL column data type -HINT: SQLite value with "text" affinity (23 bytes) : '2020-11-05 12:34:56.789' -CONTEXT: foreign table "typetest" foreign column "i" have data type "bigint" (usual affinity "integer"), processing expression at position 0 in select list + c_timestamp +------------------------- + 2020-11-05 12:34:56.789 +(1 row) + --Testcase 73: EXPLAIN (VERBOSE, COSTS OFF) -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Insert on public.typetest - Output: substr((typetest.c)::text, 2) + Output: substr(typetest.t, 2) Batch Size: 1 -> Result Output: '5'::bigint, 'm'::character varying(10), 'n '::character(10), 'opqrs'::text, '2020-11-06 12:34:56.789'::timestamp without time zone, '2020-11-05 12:34:56.789'::timestamp without time zone (5 rows) --Testcase 74: -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; -ERROR: SQLite value is not compatible with PostgreSQL column data type -HINT: SQLite value with "text" affinity (10 bytes) : 'n ' -CONTEXT: foreign table "typetest" foreign column "i" have data type "bigint" (usual affinity "integer"), processing expression at position 0 in select list +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; + sst +------ + pqrs +(1 row) + --Testcase 75: (i integer, v varchar(10), c char(10), t text, d datetime, ti timestamp); EXPLAIN (VERBOSE, COSTS OFF) UPDATE typetest SET t='upd' WHERE i=1 RETURNING *; diff --git a/expected/14.12/extra/returning.out b/expected/14.12/extra/returning.out index 6f7f74f9..b9333731 100644 --- a/expected/14.12/extra/returning.out +++ b/expected/14.12/extra/returning.out @@ -523,26 +523,30 @@ INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020. --Testcase 72: INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING ti c_timestamp; -ERROR: SQLite value is not compatible with PostgreSQL column data type -HINT: SQLite value with "text" affinity (23 bytes) : '2020-11-05 12:34:56.789' -CONTEXT: foreign table "typetest" foreign column "i" have data type "bigint" (usual affinity "integer"), processing expression at position 0 in select list + c_timestamp +------------------------- + 2020-11-05 12:34:56.789 +(1 row) + --Testcase 73: EXPLAIN (VERBOSE, COSTS OFF) -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Insert on public.typetest - Output: substr((typetest.c)::text, 2) + Output: substr(typetest.t, 2) Batch Size: 1 -> Result Output: '5'::bigint, 'm'::character varying(10), 'n '::character(10), 'opqrs'::text, '2020-11-06 12:34:56.789'::timestamp without time zone, '2020-11-05 12:34:56.789'::timestamp without time zone (5 rows) --Testcase 74: -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; -ERROR: SQLite value is not compatible with PostgreSQL column data type -HINT: SQLite value with "text" affinity (10 bytes) : 'n ' -CONTEXT: foreign table "typetest" foreign column "i" have data type "bigint" (usual affinity "integer"), processing expression at position 0 in select list +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; + sst +------ + pqrs +(1 row) + --Testcase 75: (i integer, v varchar(10), c char(10), t text, d datetime, ti timestamp); EXPLAIN (VERBOSE, COSTS OFF) UPDATE typetest SET t='upd' WHERE i=1 RETURNING *; diff --git a/expected/15.7/extra/returning.out b/expected/15.7/extra/returning.out index 6f7f74f9..b9333731 100644 --- a/expected/15.7/extra/returning.out +++ b/expected/15.7/extra/returning.out @@ -523,26 +523,30 @@ INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020. --Testcase 72: INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING ti c_timestamp; -ERROR: SQLite value is not compatible with PostgreSQL column data type -HINT: SQLite value with "text" affinity (23 bytes) : '2020-11-05 12:34:56.789' -CONTEXT: foreign table "typetest" foreign column "i" have data type "bigint" (usual affinity "integer"), processing expression at position 0 in select list + c_timestamp +------------------------- + 2020-11-05 12:34:56.789 +(1 row) + --Testcase 73: EXPLAIN (VERBOSE, COSTS OFF) -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Insert on public.typetest - Output: substr((typetest.c)::text, 2) + Output: substr(typetest.t, 2) Batch Size: 1 -> Result Output: '5'::bigint, 'm'::character varying(10), 'n '::character(10), 'opqrs'::text, '2020-11-06 12:34:56.789'::timestamp without time zone, '2020-11-05 12:34:56.789'::timestamp without time zone (5 rows) --Testcase 74: -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; -ERROR: SQLite value is not compatible with PostgreSQL column data type -HINT: SQLite value with "text" affinity (10 bytes) : 'n ' -CONTEXT: foreign table "typetest" foreign column "i" have data type "bigint" (usual affinity "integer"), processing expression at position 0 in select list +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; + sst +------ + pqrs +(1 row) + --Testcase 75: (i integer, v varchar(10), c char(10), t text, d datetime, ti timestamp); EXPLAIN (VERBOSE, COSTS OFF) UPDATE typetest SET t='upd' WHERE i=1 RETURNING *; diff --git a/expected/16.3/extra/returning.out b/expected/16.3/extra/returning.out index 6f7f74f9..b9333731 100644 --- a/expected/16.3/extra/returning.out +++ b/expected/16.3/extra/returning.out @@ -523,26 +523,30 @@ INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020. --Testcase 72: INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING ti c_timestamp; -ERROR: SQLite value is not compatible with PostgreSQL column data type -HINT: SQLite value with "text" affinity (23 bytes) : '2020-11-05 12:34:56.789' -CONTEXT: foreign table "typetest" foreign column "i" have data type "bigint" (usual affinity "integer"), processing expression at position 0 in select list + c_timestamp +------------------------- + 2020-11-05 12:34:56.789 +(1 row) + --Testcase 73: EXPLAIN (VERBOSE, COSTS OFF) -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Insert on public.typetest - Output: substr((typetest.c)::text, 2) + Output: substr(typetest.t, 2) Batch Size: 1 -> Result Output: '5'::bigint, 'm'::character varying(10), 'n '::character(10), 'opqrs'::text, '2020-11-06 12:34:56.789'::timestamp without time zone, '2020-11-05 12:34:56.789'::timestamp without time zone (5 rows) --Testcase 74: -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; -ERROR: SQLite value is not compatible with PostgreSQL column data type -HINT: SQLite value with "text" affinity (10 bytes) : 'n ' -CONTEXT: foreign table "typetest" foreign column "i" have data type "bigint" (usual affinity "integer"), processing expression at position 0 in select list +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; + sst +------ + pqrs +(1 row) + --Testcase 75: (i integer, v varchar(10), c char(10), t text, d datetime, ti timestamp); EXPLAIN (VERBOSE, COSTS OFF) UPDATE typetest SET t='upd' WHERE i=1 RETURNING *; diff --git a/expected/17.0/extra/returning.out b/expected/17.0/extra/returning.out index 6f7f74f9..b9333731 100644 --- a/expected/17.0/extra/returning.out +++ b/expected/17.0/extra/returning.out @@ -523,26 +523,30 @@ INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020. --Testcase 72: INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING ti c_timestamp; -ERROR: SQLite value is not compatible with PostgreSQL column data type -HINT: SQLite value with "text" affinity (23 bytes) : '2020-11-05 12:34:56.789' -CONTEXT: foreign table "typetest" foreign column "i" have data type "bigint" (usual affinity "integer"), processing expression at position 0 in select list + c_timestamp +------------------------- + 2020-11-05 12:34:56.789 +(1 row) + --Testcase 73: EXPLAIN (VERBOSE, COSTS OFF) -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Insert on public.typetest - Output: substr((typetest.c)::text, 2) + Output: substr(typetest.t, 2) Batch Size: 1 -> Result Output: '5'::bigint, 'm'::character varying(10), 'n '::character(10), 'opqrs'::text, '2020-11-06 12:34:56.789'::timestamp without time zone, '2020-11-05 12:34:56.789'::timestamp without time zone (5 rows) --Testcase 74: -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; -ERROR: SQLite value is not compatible with PostgreSQL column data type -HINT: SQLite value with "text" affinity (10 bytes) : 'n ' -CONTEXT: foreign table "typetest" foreign column "i" have data type "bigint" (usual affinity "integer"), processing expression at position 0 in select list +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; + sst +------ + pqrs +(1 row) + --Testcase 75: (i integer, v varchar(10), c char(10), t text, d datetime, ti timestamp); EXPLAIN (VERBOSE, COSTS OFF) UPDATE typetest SET t='upd' WHERE i=1 RETURNING *; diff --git a/sql/13.15/extra/returning.sql b/sql/13.15/extra/returning.sql index 7d81d402..6299eda7 100644 --- a/sql/13.15/extra/returning.sql +++ b/sql/13.15/extra/returning.sql @@ -170,9 +170,9 @@ INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020. INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING ti c_timestamp; --Testcase 73: EXPLAIN (VERBOSE, COSTS OFF) -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; --Testcase 74: -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; --Testcase 75: (i integer, v varchar(10), c char(10), t text, d datetime, ti timestamp); EXPLAIN (VERBOSE, COSTS OFF) diff --git a/sql/14.12/extra/returning.sql b/sql/14.12/extra/returning.sql index 7d81d402..6299eda7 100644 --- a/sql/14.12/extra/returning.sql +++ b/sql/14.12/extra/returning.sql @@ -170,9 +170,9 @@ INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020. INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING ti c_timestamp; --Testcase 73: EXPLAIN (VERBOSE, COSTS OFF) -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; --Testcase 74: -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; --Testcase 75: (i integer, v varchar(10), c char(10), t text, d datetime, ti timestamp); EXPLAIN (VERBOSE, COSTS OFF) diff --git a/sql/15.7/extra/returning.sql b/sql/15.7/extra/returning.sql index 7d81d402..6299eda7 100644 --- a/sql/15.7/extra/returning.sql +++ b/sql/15.7/extra/returning.sql @@ -170,9 +170,9 @@ INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020. INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING ti c_timestamp; --Testcase 73: EXPLAIN (VERBOSE, COSTS OFF) -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; --Testcase 74: -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; --Testcase 75: (i integer, v varchar(10), c char(10), t text, d datetime, ti timestamp); EXPLAIN (VERBOSE, COSTS OFF) diff --git a/sql/16.3/extra/returning.sql b/sql/16.3/extra/returning.sql index 7d81d402..6299eda7 100644 --- a/sql/16.3/extra/returning.sql +++ b/sql/16.3/extra/returning.sql @@ -170,9 +170,9 @@ INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020. INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING ti c_timestamp; --Testcase 73: EXPLAIN (VERBOSE, COSTS OFF) -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; --Testcase 74: -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; --Testcase 75: (i integer, v varchar(10), c char(10), t text, d datetime, ti timestamp); EXPLAIN (VERBOSE, COSTS OFF) diff --git a/sql/17.0/extra/returning.sql b/sql/17.0/extra/returning.sql index 7d81d402..6299eda7 100644 --- a/sql/17.0/extra/returning.sql +++ b/sql/17.0/extra/returning.sql @@ -170,9 +170,9 @@ INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020. INSERT INTO typetest VALUES (4, 'j', 'k', 'l', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING ti c_timestamp; --Testcase 73: EXPLAIN (VERBOSE, COSTS OFF) -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; --Testcase 74: -INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(c, 2) sst; +INSERT INTO typetest VALUES (5, 'm', 'n', 'opqrs', '2020.11.06 12:34:56.789', '2020.11.05 12:34:56.789') RETURNING substr(t, 2) sst; --Testcase 75: (i integer, v varchar(10), c char(10), t text, d datetime, ti timestamp); EXPLAIN (VERBOSE, COSTS OFF) diff --git a/sqlite_fdw.c b/sqlite_fdw.c index a20e7c1e..35af896e 100644 --- a/sqlite_fdw.c +++ b/sqlite_fdw.c @@ -1896,7 +1896,7 @@ sqliteBeginForeignModify(ModifyTableState *mtstate, #else fmstate->has_returning = intVal(list_nth(fdw_private, FdwModifyPrivateHasReturning)); #endif - fmstate->retrieved_attrs = (List *) list_nth(fdw_private, FdwModifyPrivateTargetAttnums); + fmstate->retrieved_attrs = (List *) list_nth(fdw_private, FdwModifyPrivateRetrievedAttrs); #if PG_VERSION_NUM >= 140000 fmstate->values_end = intVal(list_nth(fdw_private, FdwModifyPrivateLen)); #else @@ -1904,7 +1904,7 @@ sqliteBeginForeignModify(ModifyTableState *mtstate, #endif fmstate->orig_query = pstrdup(fmstate->query); - n_params = list_length(fmstate->retrieved_attrs) + 1; + n_params = list_length(fmstate->target_attrs) + 1; fmstate->p_flinfo = (FmgrInfo *) palloc0(sizeof(FmgrInfo) * n_params); fmstate->p_nums = 0; fmstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt, @@ -1918,7 +1918,7 @@ sqliteBeginForeignModify(ModifyTableState *mtstate, fmstate->attinmeta = TupleDescGetAttInMetadata(tupdesc); /* Set up for remaining transmittable parameters */ - foreach(lc, fmstate->retrieved_attrs) + foreach(lc, fmstate->target_attrs) { int attnum = lfirst_int(lc); Form_pg_attribute attr = TupleDescAttr(RelationGetDescr(rel), attnum - 1); @@ -1928,7 +1928,7 @@ sqliteBeginForeignModify(ModifyTableState *mtstate, /* Ignore generated columns; */ if (attr->attgenerated) { - if (list_length(fmstate->retrieved_attrs) >= 1) + if (list_length(fmstate->target_attrs) >= 1) fmstate->p_nums = 1; continue; } @@ -1944,7 +1944,7 @@ sqliteBeginForeignModify(ModifyTableState *mtstate, fmstate->batch_size = sqlite_get_batch_size_option(rel); #endif - n_params = list_length(fmstate->retrieved_attrs); + n_params = list_length(fmstate->target_attrs); /* Initialize sqlite statment */ fmstate->stmt = NULL; @@ -5389,7 +5389,7 @@ static int sqlite_foreign_modify_bind (SqliteFdwExecState *fmstate, TupleTableSl int bindnum = 0; Oid foreignTableId = RelationGetRelid(rel); /* Bind the values */ - foreach(lc, fmstate->retrieved_attrs) + foreach(lc, fmstate->target_attrs) { int attnum = lfirst_int(lc); Form_pg_attribute att = TupleDescAttr(slot->tts_tupleDescriptor, attnum - 1);