aboutsummaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw/postgres_fdw.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-03-09 23:36:44 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2017-03-09 23:36:52 -0500
commit9c2635e26f6f4e34b3b606c0fc79d0e111953a74 (patch)
treea9c715b65b8925d5ca16df366fe1d7cb91778224 /contrib/postgres_fdw/postgres_fdw.c
parentfcd8d25d38b5f42ec4ae77a673813c2dc279ccf7 (diff)
downloadpostgresql-9c2635e26f6f4e34b3b606c0fc79d0e111953a74.tar.gz
postgresql-9c2635e26f6f4e34b3b606c0fc79d0e111953a74.zip
Fix hard-coded relkind constants in assorted other files.
Although it's reasonable to expect that most of these constants will never change, that does not make it good programming style to hard-code the value rather than using the RELKIND_FOO macros. I think I've now gotten all the hard-coded references in C code. Unfortunately there's no equally convenient way to parameterize SQL files ... Discussion: https://postgr.es/m/11145.1488931324@sss.pgh.pa.us
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
-rw-r--r--contrib/postgres_fdw/postgres_fdw.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 5d270b948a9..990313a5977 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -16,6 +16,7 @@
#include "access/htup_details.h"
#include "access/sysattr.h"
+#include "catalog/pg_class.h"
#include "commands/defrem.h"
#include "commands/explain.h"
#include "commands/vacuum.h"
@@ -3885,7 +3886,11 @@ postgresImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid)
" adrelid = c.oid AND adnum = attnum ");
appendStringInfoString(&buf,
- "WHERE c.relkind IN ('r', 'v', 'f', 'm') "
+ "WHERE c.relkind IN ("
+ CppAsString2(RELKIND_RELATION) ","
+ CppAsString2(RELKIND_VIEW) ","
+ CppAsString2(RELKIND_FOREIGN_TABLE) ","
+ CppAsString2(RELKIND_MATVIEW) ") "
" AND n.nspname = ");
deparseStringLiteral(&buf, stmt->remote_schema);