getSchemas method
Get the list of user created schemas, if necessary doOrder
.
Implementation
@override
Future<List<SqlName>> getSchemas({bool doOrder = false}) async {
List<SqlName> schemaNames = [];
String orderBy = " ORDER BY table_schema";
if (!doOrder) {
orderBy = "";
}
String sql = """select s.nspname as table_schema
from pg_catalog.pg_namespace s
join pg_catalog.pg_user u on u.usesysid = s.nspowner
where nspname not in ('information_schema', 'pg_catalog', 'cron', 'topology')
and nspname not like 'pg_toast%'
and nspname not like 'pg_temp_%'
order by table_schema;
$orderBy;""";
var res = await select(sql);
res?.forEach((QueryResultRow row) {
var schema = row.get('table_schema');
schemaNames.add(SqlName(schema));
});
return schemaNames;
}