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
appendStringInfo(&query,"SELECT oid FROM pg_catalog.pg_class WHERE relnamespace = %u AND relkind IN ('r', 'm', 'v') AND pg_catalog.has_table_privilege (oid, 'SELECT') ORDER BY relname;",nspid);
appendStringInfo(&query,"SELECT oid FROM pg_catalog.pg_class"
" WHERE relnamespace = %u AND relkind IN ("
CppAsString2(RELKIND_RELATION)","
CppAsString2(RELKIND_MATVIEW)","
CppAsString2(RELKIND_VIEW)")"
" AND pg_catalog.has_table_privilege (oid, 'SELECT')"
" ORDER BY relname;",nspid);
returnquery_to_oid_list(query.data);
}
@ -2370,7 +2377,13 @@ static List *
database_get_xml_visible_tables(void)
{
/* At the moment there is no order required here. */
returnquery_to_oid_list("SELECT oid FROM pg_catalog.pg_class WHERE relkind IN ('r', 'm', 'v')ANDpg_catalog.has_table_privilege(pg_class.oid,'SELECT')ANDrelnamespaceIN(" XML_VISIBLE_SCHEMAS ");");
returnquery_to_oid_list("SELECT oid FROM pg_catalog.pg_class"
" WHERE relkind IN ("
CppAsString2(RELKIND_RELATION)","
CppAsString2(RELKIND_MATVIEW)","
CppAsString2(RELKIND_VIEW)")"
" AND pg_catalog.has_table_privilege(pg_class.oid, 'SELECT')"