From 9c2635e26f6f4e34b3b606c0fc79d0e111953a74 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 9 Mar 2017 23:36:44 -0500 Subject: 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 --- contrib/postgres_fdw/postgres_fdw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'contrib/postgres_fdw/postgres_fdw.c') 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); -- cgit v1.2.3