psql's slash commands for schemas seem a little weird to me. For
example:
neilc=# \d nonexistent
Did not find any relation named "nonexistent".
neilc=# \dt nonexistent
No matching relations found.
neilc=# \dn nonexistent
List of schemasName | Owner
------+-------
(0 rows)
-- Is there a good reason for this inconsistency?
neilc=# create schema foo_schema;
CREATE SCHEMA
neilc=# \dn foo_schema List of schemas Name | Owner
------------+-------foo_schema | neilc
(1 row)
neilc=# \dn foo_schema. List of schemas Name | Owner
--------------------+-------foo_schema | neilcinformation_schema | neilcpg_catalog | neilcpg_toast
| neilcpublic | neilc
(5 rows)
-- Why? (The same applies to "\dn nonexistent.")
neilc=# \d
No relations found.
neilc=# \d foo_schema.*
Did not find any relation named "foo_schema.*".
-- Why the difference in behavior? In any case, the error message is
confusing -- it suggests psql was looking for a relation with the name
"foo_schema.*", where it obviously was not:
neilc=# create table "foo_schema.*" (a int, b int);
CREATE TABLE
neilc=# \d foo_schema.*
Did not find any relation named "foo_schema.*".
neilc=# \d List of relationsSchema | Name | Type | Owner
--------+--------------+-------+-------public | foo_schema.* | table | neilc
(1 row)
-- When you do \d schema.*, you get the definitions of _all_ the objects
in the schema. I can see why we support this, although I can't see it
being used very often. On the other hand, I think a much more common
case would be trying to get a list of all the objects in a schema -- is
there any way to do that? \dt schema.* lists the tables in a schema, for
example, but not the other types of objects (in a similar fashion to how
"\d" displays the objects in the search path).
That's all for now :-)
-Neil