#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    55
    Rep Power
    12

    system catalogue queries


    Hi all,

    I have a good understanding of sql, but no syntactical knowledge specific to postgresql. I have created a table:

    CREATE TABLE test1 (
    test_id DECIMAL(8),
    name CHAR VARYING(40),
    PRIMARY KEY(test_id)
    );

    Now, suppose I want to check what the attributes of this table are. Is there an easy way to 'describe' the table?

    From what I can find it seems like you can query pg_class and pg_attribute, but it seems to me that there must be a quicker way of obtaining this information.

    Thanks in advance
  2. #2
  3. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    61
    From the 'psql' interface, enter '\d [tablename]'. If you just enter '\d', you get a summary description of the whole database. '\?' for more details.
    The real n-tier system:

    FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

    Amazon wishlist -- rycamor (at) gmail.com
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    55
    Rep Power
    12

    Lightbulb


    Hey, thanks Rycamor.

    That works fine.

IMN logo majestic logo threadwatch logo seochat tools logo