Oid fdwId;
Form_pg_foreign_data_wrapper form;
+ rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
+
/* Must be a superuser to change a FDW owner */
if (!superuser())
ereport(ERROR,
name),
errhint("The owner of a foreign-data wrapper must be a superuser.")));
- rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
-
tup = SearchSysCacheCopy1(FOREIGNDATAWRAPPERNAME, CStringGetDatum(name));
if (!HeapTupleIsValid(tup))
Datum fdwoptions;
Oid ownerId;
+ rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
+
/* Must be super user */
if (!superuser())
ereport(ERROR,
/*
* Insert tuple into pg_foreign_data_wrapper.
*/
- rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
-
memset(values, 0, sizeof(values));
memset(nulls, false, sizeof(nulls));
Datum datum;
Oid fdwvalidator;
+ rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
+
/* Must be super user */
if (!superuser())
ereport(ERROR,
}
/* Everything looks good - update the tuple */
-
- rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
-
tp = heap_modify_tuple(tp, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
ObjectAddress referenced;
ForeignDataWrapper *fdw;
+ rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
+
/* For now the owner cannot be specified on create. Use effective user ID. */
ownerId = GetUserId();
/*
* Insert tuple into pg_foreign_server.
*/
- rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
-
memset(values, 0, sizeof(values));
memset(nulls, false, sizeof(nulls));
Oid srvId;
Form_pg_foreign_server srvForm;
+ rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
+
tp = SearchSysCacheCopy1(FOREIGNSERVERNAME,
CStringGetDatum(stmt->servername));
}
/* Everything looks good - update the tuple */
-
- rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
-
tp = heap_modify_tuple(tp, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
ForeignServer *srv;
ForeignDataWrapper *fdw;
+ rel = heap_open(UserMappingRelationId, RowExclusiveLock);
+
useId = GetUserOidFromMapping(stmt->username, false);
/* Check that the server exists. */
/*
* Insert tuple into pg_user_mapping.
*/
- rel = heap_open(UserMappingRelationId, RowExclusiveLock);
-
memset(values, 0, sizeof(values));
memset(nulls, false, sizeof(nulls));
Oid umId;
ForeignServer *srv;
+ rel = heap_open(UserMappingRelationId, RowExclusiveLock);
+
useId = GetUserOidFromMapping(stmt->username, false);
srv = GetForeignServerByName(stmt->servername, false);
}
/* Everything looks good - update the tuple */
-
- rel = heap_open(UserMappingRelationId, RowExclusiveLock);
-
tp = heap_modify_tuple(tp, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);