\dn without "S" now hides all pg_XXX schemas as well as information_schema.
Thus, in a bare database you'll only see "public". ("public" is considered
a user schema, not a system schema, mainly because it's droppable.)
Per discussion back in late September.
<varlistentry>
- <term><literal>\dn[+] [ <link linkend="APP-PSQL-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
+ <term><literal>\dn[S+] [ <link linkend="APP-PSQL-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
<listitem>
<para>
Lists schemas (namespaces). If <replaceable
class="parameter">pattern</replaceable>
is specified, only schemas whose names match the pattern are listed.
- Non-local temporary schemas are suppressed. If <literal>+</literal>
- is appended to the command name, each object is listed with its associated
- permissions and description, if any.
+ By default, only user-created objects are shown; supply a
+ pattern or the <literal>S</literal> modifier to include system objects.
+ If <literal>+</literal> is appended to the command name, each object
+ is listed with its associated permissions and description, if any.
</para>
</listitem>
</varlistentry>
success = do_lo_list();
break;
case 'n':
- success = listSchemas(pattern, show_verbose);
+ success = listSchemas(pattern, show_verbose, show_system);
break;
case 'o':
success = describeOperators(pattern, show_system);
* Describes schemas (namespaces)
*/
bool
-listSchemas(const char *pattern, bool verbose)
+listSchemas(const char *pattern, bool verbose, bool showSystem)
{
PQExpBufferData buf;
PGresult *res;
}
appendPQExpBuffer(&buf,
- "\nFROM pg_catalog.pg_namespace n\n"
- "WHERE (n.nspname !~ '^pg_temp_' OR\n"
- " n.nspname = (pg_catalog.current_schemas(true))[1])\n"); /* temp schema is first */
+ "\nFROM pg_catalog.pg_namespace n\n");
- processSQLNamePattern(pset.db, &buf, pattern, true, false,
+ if (!showSystem && !pattern)
+ appendPQExpBuffer(&buf,
+ "WHERE n.nspname !~ '^pg_' AND n.nspname <> 'information_schema'\n");
+
+ processSQLNamePattern(pset.db, &buf, pattern,
+ !showSystem && !pattern, false,
NULL, "n.nspname", NULL,
NULL);
extern bool listCasts(const char *pattern);
/* \dn */
-extern bool listSchemas(const char *pattern, bool verbose);
+extern bool listSchemas(const char *pattern, bool verbose, bool showSystem);
/* \dew */
extern bool listForeignDataWrappers(const char *pattern, bool verbose);