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 schemas
 Name | 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         | neilc
 information_schema | neilc
 pg_catalog         | neilc
 pg_toast           | neilc
 public             | 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 relations
 Schema |     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



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to