return stricmp(curschema, (const char *) pubstr) == 0;
}
+#define TABLE_IN_RELKIND "('r', 'v', 'm', 'f', 'p')"
+
RETCODE SQL_API
PGAPI_Tables(HSTMT hstmt,
const SQLCHAR * szTableQualifier, /* PV X*/
{
/*
* Query relations depending on what is available:
+ * - 10 and newer versions have partition tables
* - 9.3 and newer versions have materialized views
* - 9.1 and newer versions have foreign tables
*/
"select NULL, NULL, relkind from (select 'r' as relkind "
"union select 'v' "
"union select 'm' "
- "union select 'f') as a");
+ "union select 'f' "
+ "union select 'p') as a");
}
else if (list_schemas)
{
*/
appendPQExpBufferStr(&tables_query, "select relname, nspname, relkind "
"from pg_catalog.pg_class c, pg_catalog.pg_namespace n "
- "where relkind in ('r', 'v', 'm', 'f')");
+ "where relkind in " TABLE_IN_RELKIND);
}
op_string = gen_opestr(like_or_eq, conn);
if (escTableName)
appendPQExpBuffer(&proc_query, " relname %s'%s' and", op_string, escTableName);
- appendPQExpBufferStr(&proc_query, " pg_namespace.oid = relnamespace and relkind in ('r', 'v') and");
+ appendPQExpBufferStr(&proc_query, " pg_namespace.oid = relnamespace and relkind in " TABLE_IN_RELKIND " and");
if ((!escTableName) && (!escSchemaName))
appendPQExpBufferStr(&proc_query, " nspname not in ('pg_catalog', 'information_schema') and");