diff options
Diffstat (limited to 'contrib/postgres_fdw')
-rw-r--r-- | contrib/postgres_fdw/deparse.c | 35 | ||||
-rw-r--r-- | contrib/postgres_fdw/expected/postgres_fdw.out | 41 | ||||
-rw-r--r-- | contrib/postgres_fdw/postgres_fdw.c | 34 | ||||
-rw-r--r-- | contrib/postgres_fdw/sql/postgres_fdw.sql | 11 |
4 files changed, 16 insertions, 105 deletions
diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c index 6001f4d25ef..654323f1554 100644 --- a/contrib/postgres_fdw/deparse.c +++ b/contrib/postgres_fdw/deparse.c @@ -332,14 +332,13 @@ foreign_expr_walker(Node *node, /* Var belongs to foreign table */ /* - * System columns other than ctid and oid should not be - * sent to the remote, since we don't make any effort to - * ensure that local and remote values match (tableoid, in + * System columns other than ctid should not be sent to + * the remote, since we don't make any effort to ensure + * that local and remote values match (tableoid, in * particular, almost certainly doesn't match). */ if (var->varattno < 0 && - var->varattno != SelfItemPointerAttributeNumber && - var->varattno != ObjectIdAttributeNumber) + var->varattno != SelfItemPointerAttributeNumber) return false; /* Else check the collation */ @@ -1145,8 +1144,8 @@ deparseTargetList(StringInfo buf, } /* - * Add ctid and oid if needed. We currently don't support retrieving any - * other system columns. + * Add ctid if needed. We currently don't support retrieving any other + * system columns. */ if (bms_is_member(SelfItemPointerAttributeNumber - FirstLowInvalidHeapAttributeNumber, attrs_used)) @@ -1164,22 +1163,6 @@ deparseTargetList(StringInfo buf, *retrieved_attrs = lappend_int(*retrieved_attrs, SelfItemPointerAttributeNumber); } - if (bms_is_member(ObjectIdAttributeNumber - FirstLowInvalidHeapAttributeNumber, - attrs_used)) - { - if (!first) - appendStringInfoString(buf, ", "); - else if (is_returning) - appendStringInfoString(buf, " RETURNING "); - first = false; - - if (qualify_col) - ADD_REL_QUALIFIER(buf, rtindex); - appendStringInfoString(buf, "oid"); - - *retrieved_attrs = lappend_int(*retrieved_attrs, - ObjectIdAttributeNumber); - } /* Don't generate bad syntax if no undropped columns */ if (first && !is_returning) @@ -2079,12 +2062,6 @@ deparseColumnRef(StringInfo buf, int varno, int varattno, RangeTblEntry *rte, ADD_REL_QUALIFIER(buf, varno); appendStringInfoString(buf, "ctid"); } - else if (varattno == ObjectIdAttributeNumber) - { - if (qualify_col) - ADD_REL_QUALIFIER(buf, varno); - appendStringInfoString(buf, "oid"); - } else if (varattno < 0) { /* diff --git a/contrib/postgres_fdw/expected/postgres_fdw.out b/contrib/postgres_fdw/expected/postgres_fdw.out index 21a2ef5ad3a..e653c302bec 100644 --- a/contrib/postgres_fdw/expected/postgres_fdw.out +++ b/contrib/postgres_fdw/expected/postgres_fdw.out @@ -129,13 +129,6 @@ CREATE FOREIGN TABLE ft6 ( c2 int NOT NULL, c3 text ) SERVER loopback2 OPTIONS (schema_name 'S 1', table_name 'T 4'); --- A table with oids. CREATE FOREIGN TABLE doesn't support the --- WITH OIDS option, but ALTER does. -CREATE FOREIGN TABLE ft_pg_type ( - typname name, - typlen smallint -) SERVER loopback OPTIONS (schema_name 'pg_catalog', table_name 'pg_type'); -ALTER TABLE ft_pg_type SET WITH OIDS; -- =================================================================== -- tests for validator -- =================================================================== @@ -185,16 +178,15 @@ ALTER FOREIGN TABLE ft2 OPTIONS (schema_name 'S 1', table_name 'T 1'); ALTER FOREIGN TABLE ft1 ALTER COLUMN c1 OPTIONS (column_name 'C 1'); ALTER FOREIGN TABLE ft2 ALTER COLUMN c1 OPTIONS (column_name 'C 1'); \det+ - List of foreign tables - Schema | Table | Server | FDW options | Description ---------+------------+-----------+--------------------------------------------------+------------- - public | ft1 | loopback | (schema_name 'S 1', table_name 'T 1') | - public | ft2 | loopback | (schema_name 'S 1', table_name 'T 1') | - public | ft4 | loopback | (schema_name 'S 1', table_name 'T 3') | - public | ft5 | loopback | (schema_name 'S 1', table_name 'T 4') | - public | ft6 | loopback2 | (schema_name 'S 1', table_name 'T 4') | - public | ft_pg_type | loopback | (schema_name 'pg_catalog', table_name 'pg_type') | -(6 rows) + List of foreign tables + Schema | Table | Server | FDW options | Description +--------+-------+-----------+---------------------------------------+------------- + public | ft1 | loopback | (schema_name 'S 1', table_name 'T 1') | + public | ft2 | loopback | (schema_name 'S 1', table_name 'T 1') | + public | ft4 | loopback | (schema_name 'S 1', table_name 'T 3') | + public | ft5 | loopback | (schema_name 'S 1', table_name 'T 4') | + public | ft6 | loopback2 | (schema_name 'S 1', table_name 'T 4') | +(5 rows) -- Test that alteration of server options causes reconnection -- Remote's errors might be non-English, so hide them to ensure stable results @@ -4048,21 +4040,6 @@ SELECT ctid, * FROM ft1 t1 LIMIT 1; (0,1) | 1 | 1 | 00001 | Fri Jan 02 00:00:00 1970 PST | Fri Jan 02 00:00:00 1970 | 1 | 1 | foo (1 row) -EXPLAIN (VERBOSE, COSTS OFF) -SELECT oid, * FROM ft_pg_type WHERE typname = 'int4'; - QUERY PLAN ----------------------------------------------------------------------------------------------------- - Foreign Scan on public.ft_pg_type - Output: oid, typname, typlen - Remote SQL: SELECT typname, typlen, oid FROM pg_catalog.pg_type WHERE ((typname = 'int4'::name)) -(3 rows) - -SELECT oid, * FROM ft_pg_type WHERE typname = 'int4'; - oid | typname | typlen ------+---------+-------- - 23 | int4 | 4 -(1 row) - -- =================================================================== -- used in PL/pgSQL function -- =================================================================== diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index 6f9c6e193fc..a5830bb89b3 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -3632,8 +3632,7 @@ build_remote_returning(Index rtindex, Relation rel, List *returningList) if (IsA(var, Var) && var->varno == rtindex && var->varattno <= InvalidAttrNumber && - var->varattno != SelfItemPointerAttributeNumber && - var->varattno != ObjectIdAttributeNumber) + var->varattno != SelfItemPointerAttributeNumber) continue; /* don't need it */ if (tlist_member((Expr *) var, tlist)) @@ -3864,8 +3863,6 @@ init_returning_filter(PgFdwDirectModifyState *dmstate, */ if (attrno == SelfItemPointerAttributeNumber) dmstate->ctidAttno = i; - else if (attrno == ObjectIdAttributeNumber) - dmstate->oidAttno = i; else Assert(false); dmstate->hasSystemCols = true; @@ -3963,15 +3960,6 @@ apply_returning_filter(PgFdwDirectModifyState *dmstate, resultTup->t_self = *ctid; } - /* oid */ - if (dmstate->oidAttno) - { - Oid oid = InvalidOid; - - oid = DatumGetObjectId(old_values[dmstate->oidAttno - 1]); - HeapTupleSetOid(resultTup, oid); - } - /* * And remaining columns * @@ -5556,7 +5544,6 @@ make_tuple_from_result_row(PGresult *res, Datum *values; bool *nulls; ItemPointer ctid = NULL; - Oid oid = InvalidOid; ConversionLocation errpos; ErrorContextCallback errcallback; MemoryContext oldcontext; @@ -5639,17 +5626,6 @@ make_tuple_from_result_row(PGresult *res, ctid = (ItemPointer) DatumGetPointer(datum); } } - else if (i == ObjectIdAttributeNumber) - { - /* oid */ - if (valstr != NULL) - { - Datum datum; - - datum = DirectFunctionCall1(oidin, CStringGetDatum(valstr)); - oid = DatumGetObjectId(datum); - } - } errpos.cur_attno = 0; j++; @@ -5693,12 +5669,6 @@ make_tuple_from_result_row(PGresult *res, HeapTupleHeaderSetXmin(tuple->t_data, InvalidTransactionId); HeapTupleHeaderSetCmin(tuple->t_data, InvalidTransactionId); - /* - * If we have an OID to return, install it. - */ - if (OidIsValid(oid)) - HeapTupleSetOid(tuple, oid); - /* Clean up */ MemoryContextReset(temp_context); @@ -5727,8 +5697,6 @@ conversion_error_callback(void *arg) attname = NameStr(attr->attname); else if (errpos->cur_attno == SelfItemPointerAttributeNumber) attname = "ctid"; - else if (errpos->cur_attno == ObjectIdAttributeNumber) - attname = "oid"; relname = RelationGetRelationName(errpos->rel); } diff --git a/contrib/postgres_fdw/sql/postgres_fdw.sql b/contrib/postgres_fdw/sql/postgres_fdw.sql index 88c4cb4783f..6aa9a7f4d9b 100644 --- a/contrib/postgres_fdw/sql/postgres_fdw.sql +++ b/contrib/postgres_fdw/sql/postgres_fdw.sql @@ -142,14 +142,6 @@ CREATE FOREIGN TABLE ft6 ( c3 text ) SERVER loopback2 OPTIONS (schema_name 'S 1', table_name 'T 4'); --- A table with oids. CREATE FOREIGN TABLE doesn't support the --- WITH OIDS option, but ALTER does. -CREATE FOREIGN TABLE ft_pg_type ( - typname name, - typlen smallint -) SERVER loopback OPTIONS (schema_name 'pg_catalog', table_name 'pg_type'); -ALTER TABLE ft_pg_type SET WITH OIDS; - -- =================================================================== -- tests for validator -- =================================================================== @@ -1002,9 +994,6 @@ SELECT * FROM ft1 t1 WHERE t1.ctid = '(0,2)'; EXPLAIN (VERBOSE, COSTS OFF) SELECT ctid, * FROM ft1 t1 LIMIT 1; SELECT ctid, * FROM ft1 t1 LIMIT 1; -EXPLAIN (VERBOSE, COSTS OFF) -SELECT oid, * FROM ft_pg_type WHERE typname = 'int4'; -SELECT oid, * FROM ft_pg_type WHERE typname = 'int4'; -- =================================================================== -- used in PL/pgSQL function |