From 302eb0c30c7c59732a5ee46a076a271e28973335 Mon Sep 17 00:00:00 2001 From: Laurenz Albe Date: Thu, 27 Jun 2019 10:13:44 +0200 Subject: [PATCH] Fix the "readonly" option of IMPORT FOREIGN TABLE When set to "false", it would still create read-only foreign tables. This closes #330 reported by Jacob Roberts. --- CHANGELOG | 3 +++ oracle_fdw.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4843427..b486912 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -24,6 +24,9 @@ Version 2.2.0 Since PostgreSQL's "numeric" does not know infinity, map these values to NaN in this case. For "real" and "double precision" we can use the normal infinity values. + - The "readonly" option of IMPORT FOREIGN SCHEMA didn't work properly: + When set to "false", it would still create read-only foreign tables. + Reported by Jacob Roberts. Version 2.1.0, released 2018-10-01 Enhancements: diff --git a/oracle_fdw.c b/oracle_fdw.c index 1cb7e13..235d806 100644 --- a/oracle_fdw.c +++ b/oracle_fdw.c @@ -2251,13 +2251,13 @@ oracleImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid) else if (strcmp(def->defname, "readonly") == 0) { char *s = ((Value *) (def->arg))->val.str; - if (pg_strcasecmp(s, "on") != 0 - || pg_strcasecmp(s, "yes") != 0 - || pg_strcasecmp(s, "true") != 0) + if (pg_strcasecmp(s, "on") == 0 + || pg_strcasecmp(s, "yes") == 0 + || pg_strcasecmp(s, "true") == 0) readonly = true; - else if (pg_strcasecmp(s, "off") != 0 - || pg_strcasecmp(s, "no") != 0 - || pg_strcasecmp(s, "false") != 0) + else if (pg_strcasecmp(s, "off") == 0 + || pg_strcasecmp(s, "no") == 0 + || pg_strcasecmp(s, "false") == 0) readonly = false; else ereport(ERROR,