getLocalTableNames method

  1. @override
Statement getLocalTableNames([
  1. List<String> notIn = const []
])
override

Fetches the names of all tables that are not in notIn.

Implementation

@override
Statement getLocalTableNames([List<String> notIn = const []]) {
  String tables = '''
    SELECT relname AS name
    FROM pg_class
    JOIN pg_namespace ON relnamespace = pg_namespace.oid
    WHERE
      relkind = 'r'
      AND nspname <> 'pg_catalog'
      AND nspname <> 'information_schema'
  ''';
  if (notIn.isNotEmpty) {
    tables +=
        '''\n  AND relname NOT IN (${notIn.mapIndexed((i, _) => '\$${i + 1}').join(', ')})''';
  }
  return Statement(
    tables,
    [...notIn],
  );
}