"SELECT d1.objid, d2.refobjid, c2.relkind AS refrelkind "
"FROM pg_depend d1 "
"JOIN pg_class c1 ON c1.oid = d1.objid "
- "AND c1.relkind = 'm' "
- "JOIN pg_rewrite r1 ON r1.ev_class = d1.objid "
+ "AND c1.relkind = " CppAsString2(RELKIND_MATVIEW)
+ " JOIN pg_rewrite r1 ON r1.ev_class = d1.objid "
"JOIN pg_depend d2 ON d2.classid = 'pg_rewrite'::regclass "
"AND d2.objid = r1.oid "
"AND d2.refobjid <> d1.objid "
"JOIN pg_class c2 ON c2.oid = d2.refobjid "
- "AND c2.relkind IN ('m','v') "
+ "AND c2.relkind IN (" CppAsString2(RELKIND_MATVIEW) ","
+ CppAsString2(RELKIND_VIEW) ") "
"WHERE d1.classid = 'pg_class'::regclass "
"UNION "
"SELECT w.objid, d3.refobjid, c3.relkind "
"AND d3.objid = r3.oid "
"AND d3.refobjid <> w.refobjid "
"JOIN pg_class c3 ON c3.oid = d3.refobjid "
- "AND c3.relkind IN ('m','v') "
+ "AND c3.relkind IN (" CppAsString2(RELKIND_MATVIEW) ","
+ CppAsString2(RELKIND_VIEW) ") "
") "
"SELECT 'pg_class'::regclass::oid AS classid, objid, refobjid "
"FROM w "
- "WHERE refrelkind = 'm'");
+ "WHERE refrelkind = " CppAsString2(RELKIND_MATVIEW));
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
buildACLQueries(acl_subquery, racl_subquery, initacl_subquery,
initracl_subquery, "c.relacl", "c.relowner",
- "CASE WHEN c.relkind = 'S' THEN 's' ELSE 'r' END::\"char\"",
+ "CASE WHEN c.relkind = " CppAsString2(RELKIND_SEQUENCE)
+ " THEN 's' ELSE 'r' END::\"char\"",
dopt->binary_upgrade);
buildACLQueries(attacl_subquery, attracl_subquery, attinitacl_subquery,
appendPQExpBufferStr(query,
"SELECT inhrelid, inhparent "
"FROM pg_inherits "
- "WHERE inhparent NOT IN (SELECT oid FROM pg_class WHERE relkind = 'P')");
+ "WHERE inhparent NOT IN (SELECT oid FROM pg_class "
+ "WHERE relkind = " CppAsString2(RELKIND_PARTITIONED_TABLE) ")");
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
{
switch (tbinfo->relkind)
{
- case (RELKIND_FOREIGN_TABLE):
+ case RELKIND_FOREIGN_TABLE:
{
PQExpBuffer query = createPQExpBuffer();
PGresult *res;
destroyPQExpBuffer(query);
break;
}
- case (RELKIND_MATVIEW):
+ case RELKIND_MATVIEW:
reltypename = "MATERIALIZED VIEW";
srvname = NULL;
ftoptions = NULL;