Commit cef8efc6 authored by Heikki Linnakangas's avatar Heikki Linnakangas

Don't use OidIsValid to check the return value of transformGenericOptions,

because transformGenericOptions returns an array, not an Oid. I'm not
sure if this fixes the crashes seen in buildfarm, but it should be fixed
anyway.
parent ea7d5199
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/foreigncmds.c,v 1.1 2008/12/19 16:25:17 petere Exp $ * $PostgreSQL: pgsql/src/backend/commands/foreigncmds.c,v 1.2 2008/12/20 09:40:56 heikki Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -316,7 +316,7 @@ CreateForeignDataWrapper(CreateFdwStmt *stmt) ...@@ -316,7 +316,7 @@ CreateForeignDataWrapper(CreateFdwStmt *stmt)
bool nulls[Natts_pg_foreign_data_wrapper]; bool nulls[Natts_pg_foreign_data_wrapper];
HeapTuple tuple; HeapTuple tuple;
Oid fdwId; Oid fdwId;
Datum fdwoptions = InvalidOid; Datum fdwoptions;
Oid ownerId; Oid ownerId;
ForeignDataWrapperLibrary *fdwlib; ForeignDataWrapperLibrary *fdwlib;
...@@ -362,7 +362,7 @@ CreateForeignDataWrapper(CreateFdwStmt *stmt) ...@@ -362,7 +362,7 @@ CreateForeignDataWrapper(CreateFdwStmt *stmt)
fdwoptions = transformGenericOptions(0, stmt->options, FdwOpt, NULL, fdwoptions = transformGenericOptions(0, stmt->options, FdwOpt, NULL,
fdwlib->validateOptionList); fdwlib->validateOptionList);
if (OidIsValid(fdwoptions)) if (PointerIsValid(DatumGetPointer(fdwoptions)))
values[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = fdwoptions; values[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = fdwoptions;
else else
nulls[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = true; nulls[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = true;
...@@ -465,7 +465,7 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt) ...@@ -465,7 +465,7 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
datum = transformGenericOptions(datum, stmt->options, FdwOpt, datum = transformGenericOptions(datum, stmt->options, FdwOpt,
NULL, fdwlib->validateOptionList); NULL, fdwlib->validateOptionList);
if (OidIsValid(datum)) if (PointerIsValid(DatumGetPointer(datum)))
repl_val[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = ObjectIdGetDatum(datum); repl_val[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = ObjectIdGetDatum(datum);
else else
repl_null[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = true; repl_null[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = true;
...@@ -565,7 +565,7 @@ void ...@@ -565,7 +565,7 @@ void
CreateForeignServer(CreateForeignServerStmt *stmt) CreateForeignServer(CreateForeignServerStmt *stmt)
{ {
Relation rel; Relation rel;
Datum srvoptions = InvalidOid; Datum srvoptions;
Datum values[Natts_pg_foreign_server]; Datum values[Natts_pg_foreign_server];
bool nulls[Natts_pg_foreign_server]; bool nulls[Natts_pg_foreign_server];
HeapTuple tuple; HeapTuple tuple;
...@@ -631,7 +631,7 @@ CreateForeignServer(CreateForeignServerStmt *stmt) ...@@ -631,7 +631,7 @@ CreateForeignServer(CreateForeignServerStmt *stmt)
srvoptions = transformGenericOptions(0, stmt->options, ServerOpt, fdw, srvoptions = transformGenericOptions(0, stmt->options, ServerOpt, fdw,
fdw->lib->validateOptionList); fdw->lib->validateOptionList);
if (OidIsValid(srvoptions)) if (PointerIsValid(DatumGetPointer(srvoptions)))
values[Anum_pg_foreign_server_srvoptions - 1] = srvoptions; values[Anum_pg_foreign_server_srvoptions - 1] = srvoptions;
else else
nulls[Anum_pg_foreign_server_srvoptions - 1] = true; nulls[Anum_pg_foreign_server_srvoptions - 1] = true;
...@@ -727,7 +727,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt) ...@@ -727,7 +727,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
datum = transformGenericOptions(datum, stmt->options, ServerOpt, datum = transformGenericOptions(datum, stmt->options, ServerOpt,
fdw, fdw->lib->validateOptionList); fdw, fdw->lib->validateOptionList);
if (OidIsValid(datum)) if (PointerIsValid(DatumGetPointer(datum)))
repl_val[Anum_pg_foreign_server_srvoptions - 1] = datum; repl_val[Anum_pg_foreign_server_srvoptions - 1] = datum;
else else
repl_null[Anum_pg_foreign_server_srvoptions - 1] = true; repl_null[Anum_pg_foreign_server_srvoptions - 1] = true;
...@@ -822,7 +822,7 @@ void ...@@ -822,7 +822,7 @@ void
CreateUserMapping(CreateUserMappingStmt *stmt) CreateUserMapping(CreateUserMappingStmt *stmt)
{ {
Relation rel; Relation rel;
Datum useoptions = InvalidOid; Datum useoptions;
Datum values[Natts_pg_user_mapping]; Datum values[Natts_pg_user_mapping];
bool nulls[Natts_pg_user_mapping]; bool nulls[Natts_pg_user_mapping];
HeapTuple tuple; HeapTuple tuple;
...@@ -877,7 +877,7 @@ CreateUserMapping(CreateUserMappingStmt *stmt) ...@@ -877,7 +877,7 @@ CreateUserMapping(CreateUserMappingStmt *stmt)
useoptions = transformGenericOptions(0, stmt->options, UserMappingOpt, useoptions = transformGenericOptions(0, stmt->options, UserMappingOpt,
fdw, fdw->lib->validateOptionList); fdw, fdw->lib->validateOptionList);
if (OidIsValid(useoptions)) if (PointerIsValid(DatumGetPointer(useoptions)))
values[Anum_pg_user_mapping_umoptions - 1] = useoptions; values[Anum_pg_user_mapping_umoptions - 1] = useoptions;
else else
nulls[Anum_pg_user_mapping_umoptions - 1] = true; nulls[Anum_pg_user_mapping_umoptions - 1] = true;
...@@ -977,7 +977,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt) ...@@ -977,7 +977,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
datum = transformGenericOptions(datum, stmt->options, UserMappingOpt, datum = transformGenericOptions(datum, stmt->options, UserMappingOpt,
fdw, fdw->lib->validateOptionList); fdw, fdw->lib->validateOptionList);
if (OidIsValid(datum)) if (PointerIsValid(DatumGetPointer(datum)))
repl_val[Anum_pg_user_mapping_umoptions - 1] = datum; repl_val[Anum_pg_user_mapping_umoptions - 1] = datum;
else else
repl_null[Anum_pg_user_mapping_umoptions - 1] = true; repl_null[Anum_pg_user_mapping_umoptions - 1] = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment