Any idea to get a human readable list with column descriptions like
type,size,key,default,null.
It would be nice if it would look simular to the mysql variant:

mysql> describe employee;
+-----------+----------+------+-----+---------+----------------+
Field | Type | Null | Key | Default | Extra |
+-----------+----------+------+-----+---------+----------------+
Id | int(11) | | PRI | NULL | auto_increment |
FirstName | char(30) | | MUL | | |
LastName | char(30) | | | | |
Infix | char(10) | YES | | NULL | |
Address1 | char(30) | YES | | NULL | |
PostCode | char(10) | YES | | NULL | |
Town | int(11) | YES | | NULL | |
+-----------+----------+------+-----+---------+----------------+

Cheers, Ron.

Search Discussions

  • None at Oct 19, 2001 at 1:05 pm
    Hello


    psql <dbname>

    \dt employee

    Should do the trick





    "Ron de Jong" <radejong@planet.nl> wrote in
    news:9qp2et$i7q$1@reader05.wxs.nl:
    Any idea to get a human readable list with column descriptions like
    type,size,key,default,null.
    It would be nice if it would look simular to the mysql variant:

    mysql> describe employee;
    +-----------+----------+------+-----+---------+----------------+
    Field | Type | Null | Key | Default | Extra |
    +-----------+----------+------+-----+---------+----------------+ Id
    int(11) | | PRI | NULL | auto_increment | FirstName |
    char(30) | | MUL | | | LastName |
    char(30) | | | | | Infix |
    char(10) | YES | | NULL | | Address1 |
    char(30) | YES | | NULL | | PostCode |
    char(10) | YES | | NULL | | Town | int(11)
    YES | | NULL | |
    +-----------+----------+------+-----+---------+----------------+
    Cheers, Ron.


    int(11)&nbsp; | YES&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; |
    NULL&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp ;
    <BR>+-----------+----------+------+-----+---------+----------------+</FO
    NT></FONT></DIV>
    <DIV><FONT face=Arial size=2><FONT face="Courier
    New"></FONT></FONT>&nbsp;</DIV> <DIV><FONT face=Arial size=2><FONT
    face="Courier New">Cheers,
    Ron.<BR><BR></DIV></FONT></FONT></BODY></HTML>

    Attachment decoded: untitled-3.htm
    ------=_NextPart_000_00A9_01C158A1.1FB50320--

    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    ----------------------------------------------------------
    http://www.usenet.com
  • Ron de Jong at Oct 20, 2001 at 3:35 pm
    Not even close!

    <None> wrote in message news:3bd02277$1_4@Usenet.com...
    Hello


    psql <dbname>

    \dt employee

    Should do the trick





    "Ron de Jong" <radejong@planet.nl> wrote in
    news:9qp2et$i7q$1@reader05.wxs.nl:
    Any idea to get a human readable list with column descriptions like
    type,size,key,default,null.
    It would be nice if it would look simular to the mysql variant:

    mysql> describe employee;
    +-----------+----------+------+-----+---------+----------------+
    Field | Type | Null | Key | Default | Extra |
    +-----------+----------+------+-----+---------+----------------+ Id
    int(11) | | PRI | NULL | auto_increment | FirstName |
    char(30) | | MUL | | | LastName |
    char(30) | | | | | Infix |
    char(10) | YES | | NULL | | Address1 |
    char(30) | YES | | NULL | | PostCode |
    char(10) | YES | | NULL | | Town | int(11)
    YES | | NULL | |
    +-----------+----------+------+-----+---------+----------------+
    Cheers, Ron.


    int(11)&nbsp; | YES&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; |
    NULL&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp ;
    <BR>+-----------+----------+------+-----+---------+----------------+</FO
    NT></FONT></DIV>
    <DIV><FONT face=Arial size=2><FONT face="Courier
    New"></FONT></FONT>&nbsp;</DIV> <DIV><FONT face=Arial size=2><FONT
    face="Courier New">Cheers,
    Ron.<BR><BR></DIV></FONT></FONT></BODY></HTML>

    Attachment decoded: untitled-3.htm
    ------=_NextPart_000_00A9_01C158A1.1FB50320--

    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    ----------------------------------------------------------
    http://www.usenet.com
  • Ross J. Reedstrom at Oct 23, 2001 at 6:26 pm

    On Sat, Oct 20, 2001 at 05:24:39PM +0200, Ron de Jong wrote:
    Not even close!
    Oh? What's it missing? the \dt display in psql has all the information
    in your mythical table versionbelow, just organized a little differently,
    doesn't it?

    Particularly on the hackers list, if there's a feature you think is
    lacking on PostgreSQL, then _describe_ it (pun intended)

    Ross
    <None> wrote in message news:3bd02277$1_4@Usenet.com...
    Hello

    psql <dbname>

    \dt employee

    Should do the trick


    "Ron de Jong" <radejong@planet.nl> wrote in
    news:9qp2et$i7q$1@reader05.wxs.nl:
    Any idea to get a human readable list with column descriptions like
    type,size,key,default,null.
    It would be nice if it would look simular to the mysql variant:

    mysql> describe employee;
    +-----------+----------+------+-----+---------+----------------+
    Field | Type | Null | Key | Default | Extra |
    +-----------+----------+------+-----+---------+----------------+ Id
    int(11) | | PRI | NULL | auto_increment | FirstName |
    char(30) | | MUL | | | LastName |
    char(30) | | | | | Infix |
    char(10) | YES | | NULL | | Address1 |
    char(30) | YES | | NULL | | PostCode |
    char(10) | YES | | NULL | | Town | int(11)
    YES | | NULL | |
    +-----------+----------+------+-----+---------+----------------+
    Cheers, Ron.


    int(11)&nbsp; | YES&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; |
    NULL&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp ;
    <BR>+-----------+----------+------+-----+---------+----------------+</FO
    NT></FONT></DIV>
    <DIV><FONT face=Arial size=2><FONT face="Courier
    New"></FONT></FONT>&nbsp;</DIV> <DIV><FONT face=Arial size=2><FONT
    face="Courier New">Cheers,
    Ron.<BR><BR></DIV></FONT></FONT></BODY></HTML>

    Attachment decoded: untitled-3.htm
    ------=_NextPart_000_00A9_01C158A1.1FB50320--

    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    ----------------------------------------------------------
    http://www.usenet.com


    ---------------------------(end of broadcast)---------------------------
    TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
    --
    Ross Reedstrom, Ph.D. reedstrm@rice.edu
    Executive Director phone: 713-348-6166
    Gulf Coast Consortium for Bioinformatics fax: 713-348-6182
    Rice University MS-39
    Houston, TX 77005
  • David Eduardo Gomez Noguera at Oct 24, 2001 at 1:27 am
    Reply.
    On Sat, Oct 20, 2001 at 05:24:39PM +0200, Ron de Jong wrote:
    Not even close!
    Oh? What's it missing? the \dt display in psql has all the information
    in your mythical table versionbelow, just organized a little differently,
    doesn't it?

    Particularly on the hackers list, if there's a feature you think is
    lacking on PostgreSQL, then _describe_ it (pun intended)
    agreed.
    besides, what he want can be obtained by making queries to the system tables.
    just have to look through them a bit.
    Ross
    <None> wrote in message news:3bd02277$1_4@Usenet.com...
    Hello

    psql <dbname>

    \dt employee

    Should do the trick


    "Ron de Jong" <radejong@planet.nl> wrote in
    news:9qp2et$i7q$1@reader05.wxs.nl:
    Any idea to get a human readable list with column descriptions like
    type,size,key,default,null.
    It would be nice if it would look simular to the mysql variant:

    mysql> describe employee;
    +-----------+----------+------+-----+---------+----------------+
    Field | Type | Null | Key | Default | Extra |
    +-----------+----------+------+-----+---------+----------------+ Id
    int(11) | | PRI | NULL | auto_increment | FirstName |
    char(30) | | MUL | | | LastName |
    char(30) | | | | | Infix |
    char(10) | YES | | NULL | | Address1 |
    char(30) | YES | | NULL | | PostCode |
    char(10) | YES | | NULL | | Town | int(11)
    YES | | NULL | |
    +-----------+----------+------+-----+---------+----------------+
    Cheers, Ron.


    int(11)&nbsp; | YES&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; |
    NULL&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp ;
    <BR>+-----------+----------+------+-----+---------+----------------+</FO
    NT></FONT></DIV>
    <DIV><FONT face=Arial size=2><FONT face="Courier
    New"></FONT></FONT>&nbsp;</DIV> <DIV><FONT face=Arial size=2><FONT
    face="Courier New">Cheers,
    Ron.<BR><BR></DIV></FONT></FONT></BODY></HTML>

    Attachment decoded: untitled-3.htm
    ------=_NextPart_000_00A9_01C158A1.1FB50320--

    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    ----------------------------------------------------------
    http://www.usenet.com


    ---------------------------(end of broadcast)---------------------------
    TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


    --
    ICQ: 15605359 Bicho
    =^..^=
    First, they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Gandhi.
    ........Por que no pensaran los hombres como los animales? Pink Panther........
    -------------------------------気検体の一致------------------------------------
    暑さ寒さも彼岸まで。
    アン アン アン とっても大好き
  • Tweekie at Oct 26, 2001 at 10:05 am
    Hello

    As the person who gave the original suggestion, I'd like to say that if you
    gave some more information, we may be able to help. What do you see when you
    do \dt ?

    When I do it, I see more or less exactly what you report in mysql.


    "Ron de Jong" <radejong@planet.nl> wrote in
    news:9qs50m$pdf$1@reader07.wxs.nl:
    Not even close!

    <None> wrote in message news:3bd02277$1_4@Usenet.com...
    Hello


    psql <dbname>

    \dt employee

    Should do the trick





    "Ron de Jong" <radejong@planet.nl> wrote in
    news:9qp2et$i7q$1@reader05.wxs.nl:
    Any idea to get a human readable list with column descriptions like
    type,size,key,default,null. It would be nice if it would look
    simular to the mysql variant:

    mysql> describe employee;
    +-----------+----------+------+-----+---------+----------------+
    Field | Type | Null | Key | Default | Extra |
    +-----------+----------+------+-----+---------+----------------+ Id
    int(11) | | PRI | NULL | auto_increment | FirstName
    char(30) | | MUL | | | LastName |
    char(30) | | | | | Infix |
    char(10) | YES | | NULL | | Address1 |
    char(30) | YES | | NULL | | PostCode |
    char(10)
    YES | | NULL | | Town | int(11)
    YES | | NULL | |
    +-----------+----------+------+-----+---------+----------------+
    Cheers, Ron.

    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    ----------------------------------------------------------
    http://www.usenet.com
  • David Eduardo Gomez Noguera at Oct 19, 2001 at 2:18 pm

    ---------- Forwarded message ----------
    Date: Fri, 19 Oct 2001 08:22:46 -0600
    From: David Eduardo Gomez Noguera <davidgn@servidor.unam.mx>
    To: "Ron de Jong" <Ron.Antispam@news.tht.net>
    Cc: davidgn@servidor.unam.mx
    Subject: Re: [HACKERS] Is there no "DESCRIBE <TABLE>;" on PGSQL? help!!!
    on psql, do \? there are a lot of commands that let you do it:

    \l (this list databases)
    dabicho=# \l
    List of databases
    Database | Owner | Encoding
    -------------+----------+-----------
    agenda | dabicho | SQL_ASCII
    cele | dabicho | SQL_ASCII
    dabicho | dabicho | SQL_ASCII
    diccionario | dabicho | SQL_ASCII
    imagenes | dabicho | SQL_ASCII
    libros | dabicho | SQL_ASCII
    mp3 | dabicho | SQL_ASCII
    postgres | postgres | SQL_ASCII
    template0 | postgres | SQL_ASCII
    template1 | postgres | SQL_ASCII
    (10 rows)

    mp3=# \d (this list tables on the current db)
    List of relations
    Name | Type | Owner
    ----------------+----------+---------
    album | table | dabicho
    album_id_seq | sequence | dabicho
    artista | table | dabicho
    artista_id_seq | sequence | dabicho
    dirpath | table | dabicho
    dirpath_id_seq | sequence | dabicho
    genero | table | dabicho
    genero_id_seq | sequence | dabicho
    mp3 | table | dabicho
    mp3_id_seq | sequence | dabicho
    pga_forms | table | dabicho
    pga_layout | table | dabicho
    pga_queries | table | dabicho
    pga_reports | table | dabicho
    pga_schema | table | dabicho
    pga_scripts | table | dabicho


    mp3=# \d mp3 (this describes a table (mp3)
    Table "mp3"
    Attribute | Type | Modifier
    ---------------+-------------------+------------------------------------------------
    id | integer | not null default nextval('"mp3_id_seq"'::text)
    fk_dirpath_id | integer | not null
    filename | character varying | not null
    titulo | text | not null default 'unknown'
    fk_artista_id | integer | not null default 1
    fk_album_id | integer | not null default 1
    comentario | text | not null default 'none'
    year | integer | default 2001
    genero | smallint | not null default 1
    Indices: mp3_fk_dirpath_id_key,
    mp3_pkey

    with \pset you can set output format.

    mp3=# \pset expanded
    Expanded display is on.
    mp3=# \d mp3
    Table "mp3"
    -[ RECORD 1 ]---------------------------------------------
    Attribute | id
    Type | integer
    Modifier | not null default nextval('"mp3_id_seq"'::text)
    -[ RECORD 2 ]---------------------------------------------
    Attribute | fk_dirpath_id
    Type | integer
    Modifier | not null
    -[ RECORD 3 ]---------------------------------------------
    ....
    there are many combinations
    mp3=# \pset border 2
    Border style is 2.
    mp3=# \d mp3
    Table "mp3"
    +---------------+-------------------+------------------------------------------------+
    Attribute | Type | Modifier |
    +---------------+-------------------+------------------------------------------------+
    id | integer | not null default nextval('"mp3_id_seq"'::text) |
    fk_dirpath_id | integer | not null |
    filename | character varying | not null |
    titulo | text | not null default 'unknown' |
    fk_artista_id | integer | not null default 1 |
    fk_album_id | integer | not null default 1 |
    comentario | text | not null default 'none' |
    year | integer | default 2001 |
    genero | smallint | not null default 1 |
    +---------------+-------------------+------------------------------------------------+
    Indices: mp3_fk_dirpath_id_key,
    mp3_pkey

    pretty much the same, and fairly human readable to me. (although not everything sorted in columns, i guess you could do querys to the system tables to get that, or use awk to get the bits you want =) )
    I just this the postgres team has don an excelent work so far.

    Reply.
    Any idea to get a human readable list with column descriptions like
    type,size,key,default,null.
    It would be nice if it would look simular to the mysql variant:

    mysql> describe employee;
    +-----------+----------+------+-----+---------+----------------+
    Field | Type | Null | Key | Default | Extra |
    +-----------+----------+------+-----+---------+----------------+
    Id | int(11) | | PRI | NULL | auto_increment |
    FirstName | char(30) | | MUL | | |
    LastName | char(30) | | | | |
    Infix | char(10) | YES | | NULL | |
    Address1 | char(30) | YES | | NULL | |
    PostCode | char(10) | YES | | NULL | |
    Town | int(11) | YES | | NULL | |
    +-----------+----------+------+-----+---------+----------------+

    Cheers, Ron.



    --
    ICQ: 15605359 Bicho
    =^..^=
    First, they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Gandhi.
    ........Por que no pensaran los hombres como los animales? Pink Panther........
    -------------------------------気検体の一致------------------------------------
    暑さ寒さも彼岸まで。
    アン アン アン とっても大好き
    on psql, do \? there are a lot of commands that let you do it:

    \l (this list databases)
    dabicho=# \l
    List of databases
    Database | Owner | Encoding
    -------------+----------+-----------
    agenda | dabicho | SQL_ASCII
    cele | dabicho | SQL_ASCII
    dabicho | dabicho | SQL_ASCII
    diccionario | dabicho | SQL_ASCII
    imagenes | dabicho | SQL_ASCII
    libros | dabicho | SQL_ASCII
    mp3 | dabicho | SQL_ASCII
    postgres | postgres | SQL_ASCII
    template0 | postgres | SQL_ASCII
    template1 | postgres | SQL_ASCII
    (10 rows)

    mp3=# \d (this list tables on the current db)
    List of relations
    Name | Type | Owner
    ----------------+----------+---------
    album | table | dabicho
    album_id_seq | sequence | dabicho
    artista | table | dabicho
    artista_id_seq | sequence | dabicho
    dirpath | table | dabicho
    dirpath_id_seq | sequence | dabicho
    genero | table | dabicho
    genero_id_seq | sequence | dabicho
    mp3 | table | dabicho
    mp3_id_seq | sequence | dabicho
    pga_forms | table | dabicho
    pga_layout | table | dabicho
    pga_queries | table | dabicho
    pga_reports | table | dabicho
    pga_schema | table | dabicho
    pga_scripts | table | dabicho


    mp3=# \d mp3 (this describes a table (mp3)
    Table "mp3"
    Attribute | Type | Modifier
    ---------------+-------------------+------------------------------------------------
    id | integer | not null default nextval('"mp3_id_seq"'::text)
    fk_dirpath_id | integer | not null
    filename | character varying | not null
    titulo | text | not null default 'unknown'
    fk_artista_id | integer | not null default 1
    fk_album_id | integer | not null default 1
    comentario | text | not null default 'none'
    year | integer | default 2001
    genero | smallint | not null default 1
    Indices: mp3_fk_dirpath_id_key,
    mp3_pkey

    with \pset you can set output format.

    mp3=# \pset expanded
    Expanded display is on.
    mp3=# \d mp3
    Table "mp3"
    -[ RECORD 1 ]---------------------------------------------
    Attribute | id
    Type | integer
    Modifier | not null default nextval('"mp3_id_seq"'::text)
    -[ RECORD 2 ]---------------------------------------------
    Attribute | fk_dirpath_id
    Type | integer
    Modifier | not null
    -[ RECORD 3 ]---------------------------------------------
    ....
    there are many combinations
    mp3=# \pset border 2
    Border style is 2.
    mp3=# \d mp3
    Table "mp3"
    +---------------+-------------------+------------------------------------------------+
    Attribute | Type | Modifier |
    +---------------+-------------------+------------------------------------------------+
    id | integer | not null default nextval('"mp3_id_seq"'::text) |
    fk_dirpath_id | integer | not null |
    filename | character varying | not null |
    titulo | text | not null default 'unknown' |
    fk_artista_id | integer | not null default 1 |
    fk_album_id | integer | not null default 1 |
    comentario | text | not null default 'none' |
    year | integer | default 2001 |
    genero | smallint | not null default 1 |
    +---------------+-------------------+------------------------------------------------+
    Indices: mp3_fk_dirpath_id_key,
    mp3_pkey

    pretty much the same, and fairly human readable to me. (although not everything sorted in columns, i guess you could do querys to the system tables to get that, or use awk to get the bits you want =) )
    I just this the postgres team has don an excelent work so far.

    Reply.
    Any idea to get a human readable list with column descriptions like
    type,size,key,default,null.
    It would be nice if it would look simular to the mysql variant:

    mysql> describe employee;
    +-----------+----------+------+-----+---------+----------------+
    Field | Type | Null | Key | Default | Extra |
    +-----------+----------+------+-----+---------+----------------+
    Id | int(11) | | PRI | NULL | auto_increment |
    FirstName | char(30) | | MUL | | |
    LastName | char(30) | | | | |
    Infix | char(10) | YES | | NULL | |
    Address1 | char(30) | YES | | NULL | |
    PostCode | char(10) | YES | | NULL | |
    Town | int(11) | YES | | NULL | |
    +-----------+----------+------+-----+---------+----------------+

    Cheers, Ron.



    --
    ICQ: 15605359 Bicho
    =^..^=
    First, they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Gandhi.
    ........Por que no pensaran los hombres como los animales? Pink Panther........
    -------------------------------気検体の一致------------------------------------
    暑さ寒さも彼岸まで。
    アン アン アン とっても大好き

    --
    ICQ: 15605359 Bicho
    =^..^=
    First, they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Gandhi.
    ........Por que no pensaran los hombres como los animales? Pink Panther........
    -------------------------------気検体の一致------------------------------------
    暑さ寒さも彼岸まで。
    アン アン アン とっても大好き
  • David Eduardo Gomez Noguera at Oct 19, 2001 at 2:36 pm
    Sorry about that message. My mailer had a bad reply format.


    --
    ICQ: 15605359 Bicho
    =^..^=
    First, they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Gandhi.
    ........Por que no pensaran los hombres como los animales? Pink Panther........
    -------------------------------気検体の一致------------------------------------
    暑さ寒さも彼岸まで。
    アン アン アン とっても大好き
  • Ron de Jong at Oct 20, 2001 at 4:05 pm
    If you like the psql client then have a look at a graphical "psql" CGI
    program!!!
    It's just one file twdba.cgi to put in your cgi-bin directory and your
    browser does the rest.

    http://home.planet.nl/~radejong (TWDBA Download button)

    You see the \? tricks only work with that particular psql client and the
    engine does not honor them from another client.

    You'll love it!!!


    "David Eduardo Gomez Noguera" <davidgn@servidor.unam.mx> wrote in message
    news:20011019082812.2bf29485.davidgn@servidor.unam.mx...
    ---------- Forwarded message ----------
    Date: Fri, 19 Oct 2001 08:22:46 -0600
    From: David Eduardo Gomez Noguera <davidgn@servidor.unam.mx>
    To: "Ron de Jong" <Ron.Antispam@news.tht.net>
    Cc: davidgn@servidor.unam.mx
    Subject: Re: [HACKERS] Is there no "DESCRIBE <TABLE>;" on PGSQL? help!!!
    on psql, do \? there are a lot of commands that let you do it:

    \l (this list databases)
    dabicho=# \l
    List of databases
    Database | Owner | Encoding
    -------------+----------+-----------
    agenda | dabicho | SQL_ASCII
    cele | dabicho | SQL_ASCII
    dabicho | dabicho | SQL_ASCII
    diccionario | dabicho | SQL_ASCII
    imagenes | dabicho | SQL_ASCII
    libros | dabicho | SQL_ASCII
    mp3 | dabicho | SQL_ASCII
    postgres | postgres | SQL_ASCII
    template0 | postgres | SQL_ASCII
    template1 | postgres | SQL_ASCII
    (10 rows)

    mp3=# \d (this list tables on the current db)
    List of relations
    Name | Type | Owner
    ----------------+----------+---------
    album | table | dabicho
    album_id_seq | sequence | dabicho
    artista | table | dabicho
    artista_id_seq | sequence | dabicho
    dirpath | table | dabicho
    dirpath_id_seq | sequence | dabicho
    genero | table | dabicho
    genero_id_seq | sequence | dabicho
    mp3 | table | dabicho
    mp3_id_seq | sequence | dabicho
    pga_forms | table | dabicho
    pga_layout | table | dabicho
    pga_queries | table | dabicho
    pga_reports | table | dabicho
    pga_schema | table | dabicho
    pga_scripts | table | dabicho


    mp3=# \d mp3 (this describes a table (mp3)
    Table "mp3"
    Attribute | Type | Modifier
    ---------------+-------------------+--------------------------------------
    ----------
    id | integer | not null default
    nextval('"mp3_id_seq"'::text)
    fk_dirpath_id | integer | not null
    filename | character varying | not null
    titulo | text | not null default 'unknown'
    fk_artista_id | integer | not null default 1
    fk_album_id | integer | not null default 1
    comentario | text | not null default 'none'
    year | integer | default 2001
    genero | smallint | not null default 1
    Indices: mp3_fk_dirpath_id_key,
    mp3_pkey

    with \pset you can set output format.

    mp3=# \pset expanded
    Expanded display is on.
    mp3=# \d mp3
    Table "mp3"
    -[ RECORD 1 ]---------------------------------------------
    Attribute | id
    Type | integer
    Modifier | not null default nextval('"mp3_id_seq"'::text)
    -[ RECORD 2 ]---------------------------------------------
    Attribute | fk_dirpath_id
    Type | integer
    Modifier | not null
    -[ RECORD 3 ]---------------------------------------------
    ....
    there are many combinations
    mp3=# \pset border 2
    Border style is 2.
    mp3=# \d mp3
    Table "mp3"
    +---------------+-------------------+---------------------------------------
    ---------+
    Attribute | Type | Modifier
    >
    +---------------+-------------------+---------------------------------------
    ---------+
    id | integer | not null default
    nextval('"mp3_id_seq"'::text) |
    fk_dirpath_id | integer | not null
    filename | character varying | not null
    titulo | text | not null default 'unknown'
    fk_artista_id | integer | not null default 1
    fk_album_id | integer | not null default 1
    comentario | text | not null default 'none'
    year | integer | default 2001
    genero | smallint | not null default 1
    >
    +---------------+-------------------+---------------------------------------
    ---------+
    Indices: mp3_fk_dirpath_id_key,
    mp3_pkey

    pretty much the same, and fairly human readable to me. (although not
    everything sorted in columns, i guess you could do querys to the system
    tables to get that, or use awk to get the bits you want =) )
    I just this the postgres team has don an excelent work so far.

    Reply.
    Any idea to get a human readable list with column descriptions like
    type,size,key,default,null.
    It would be nice if it would look simular to the mysql variant:

    mysql> describe employee;
    +-----------+----------+------+-----+---------+----------------+
    Field | Type | Null | Key | Default | Extra |
    +-----------+----------+------+-----+---------+----------------+
    Id | int(11) | | PRI | NULL | auto_increment |
    FirstName | char(30) | | MUL | | |
    LastName | char(30) | | | | |
    Infix | char(10) | YES | | NULL | |
    Address1 | char(30) | YES | | NULL | |
    PostCode | char(10) | YES | | NULL | |
    Town | int(11) | YES | | NULL | |
    +-----------+----------+------+-----+---------+----------------+

    Cheers, Ron.



    --
    ICQ: 15605359 Bicho
    =^..^=
    First, they ignore you. Then they laugh at you. Then they fight you. Then
    you win. Mahatma Gandhi.
    ........Por que no pensaran los hombres como los animales? Pink
    Panther........
    -------------------------------$B5$8!BN$N0lCW(B-------------------------
    -----------
    $B=k$54($5$bH`4_$^$G!#(B
    $B%"%s(B $B%"%s(B $B%"%s(B $B$H$C$F$bBg9%$-(B
    on psql, do \? there are a lot of commands that let you do it:

    \l (this list databases)
    dabicho=# \l
    List of databases
    Database | Owner | Encoding
    -------------+----------+-----------
    agenda | dabicho | SQL_ASCII
    cele | dabicho | SQL_ASCII
    dabicho | dabicho | SQL_ASCII
    diccionario | dabicho | SQL_ASCII
    imagenes | dabicho | SQL_ASCII
    libros | dabicho | SQL_ASCII
    mp3 | dabicho | SQL_ASCII
    postgres | postgres | SQL_ASCII
    template0 | postgres | SQL_ASCII
    template1 | postgres | SQL_ASCII
    (10 rows)

    mp3=# \d (this list tables on the current db)
    List of relations
    Name | Type | Owner
    ----------------+----------+---------
    album | table | dabicho
    album_id_seq | sequence | dabicho
    artista | table | dabicho
    artista_id_seq | sequence | dabicho
    dirpath | table | dabicho
    dirpath_id_seq | sequence | dabicho
    genero | table | dabicho
    genero_id_seq | sequence | dabicho
    mp3 | table | dabicho
    mp3_id_seq | sequence | dabicho
    pga_forms | table | dabicho
    pga_layout | table | dabicho
    pga_queries | table | dabicho
    pga_reports | table | dabicho
    pga_schema | table | dabicho
    pga_scripts | table | dabicho


    mp3=# \d mp3 (this describes a table (mp3)
    Table "mp3"
    Attribute | Type | Modifier
    ---------------+-------------------+--------------------------------------
    ----------
    id | integer | not null default
    nextval('"mp3_id_seq"'::text)
    fk_dirpath_id | integer | not null
    filename | character varying | not null
    titulo | text | not null default 'unknown'
    fk_artista_id | integer | not null default 1
    fk_album_id | integer | not null default 1
    comentario | text | not null default 'none'
    year | integer | default 2001
    genero | smallint | not null default 1
    Indices: mp3_fk_dirpath_id_key,
    mp3_pkey

    with \pset you can set output format.

    mp3=# \pset expanded
    Expanded display is on.
    mp3=# \d mp3
    Table "mp3"
    -[ RECORD 1 ]---------------------------------------------
    Attribute | id
    Type | integer
    Modifier | not null default nextval('"mp3_id_seq"'::text)
    -[ RECORD 2 ]---------------------------------------------
    Attribute | fk_dirpath_id
    Type | integer
    Modifier | not null
    -[ RECORD 3 ]---------------------------------------------
    ....
    there are many combinations
    mp3=# \pset border 2
    Border style is 2.
    mp3=# \d mp3
    Table "mp3"
    +---------------+-------------------+---------------------------------------
    ---------+
    Attribute | Type | Modifier
    > >
    +---------------+-------------------+---------------------------------------
    ---------+
    id | integer | not null default
    nextval('"mp3_id_seq"'::text) |
    fk_dirpath_id | integer | not null
    filename | character varying | not null
    titulo | text | not null default 'unknown'
    fk_artista_id | integer | not null default 1
    fk_album_id | integer | not null default 1
    comentario | text | not null default 'none'
    year | integer | default 2001
    genero | smallint | not null default 1
    > >
    +---------------+-------------------+---------------------------------------
    ---------+
    Indices: mp3_fk_dirpath_id_key,
    mp3_pkey

    pretty much the same, and fairly human readable to me. (although not
    everything sorted in columns, i guess you could do querys to the system
    tables to get that, or use awk to get the bits you want =) )
    I just this the postgres team has don an excelent work so far.

    Reply.
    Any idea to get a human readable list with column descriptions like
    type,size,key,default,null.
    It would be nice if it would look simular to the mysql variant:

    mysql> describe employee;
    +-----------+----------+------+-----+---------+----------------+
    Field | Type | Null | Key | Default | Extra |
    +-----------+----------+------+-----+---------+----------------+
    Id | int(11) | | PRI | NULL | auto_increment |
    FirstName | char(30) | | MUL | | |
    LastName | char(30) | | | | |
    Infix | char(10) | YES | | NULL | |
    Address1 | char(30) | YES | | NULL | |
    PostCode | char(10) | YES | | NULL | |
    Town | int(11) | YES | | NULL | |
    +-----------+----------+------+-----+---------+----------------+

    Cheers, Ron.



    --
    ICQ: 15605359 Bicho
    =^..^=
    First, they ignore you. Then they laugh at you. Then they fight you.
    Then you win. Mahatma Gandhi.
    ........Por que no pensaran los hombres como los animales? Pink
    Panther........
    -------------------------------$B5$8!BN$N0lCW(B-------------------------
    -----------
    $B=k$54($5$bH`4_$^$G!#(B
    $B%"%s(B $B%"%s(B $B%"%s(B $B$H$C$F$bBg9%$-(B

    --
    ICQ: 15605359 Bicho
    =^..^=
    First, they ignore you. Then they laugh at you. Then they fight you. Then
    you win. Mahatma Gandhi.
    ........Por que no pensaran los hombres como los animales? Pink
    Panther........
    -------------------------------$B5$8!BN$N0lCW(B-------------------------
    -----------
    $B=k$54($5$bH`4_$^$G!#(B
    $B%"%s(B $B%"%s(B $B%"%s(B $B$H$C$F$bBg9%$-(B


    ---------------------------(end of broadcast)---------------------------
    TIP 3: if posting/reading through Usenet, please send an appropriate
    subscribe-nomail command to majordomo@postgresql.org so that your
    message can get through to the mailing list cleanly
  • Bruce Momjian at Oct 19, 2001 at 2:57 pm
    psql \d command.
    Any idea to get a human readable list with column descriptions like
    type,size,key,default,null.
    It would be nice if it would look simular to the mysql variant:

    mysql> describe employee;
    +-----------+----------+------+-----+---------+----------------+
    Field | Type | Null | Key | Default | Extra |
    +-----------+----------+------+-----+---------+----------------+
    Id | int(11) | | PRI | NULL | auto_increment |
    FirstName | char(30) | | MUL | | |
    LastName | char(30) | | | | |
    Infix | char(10) | YES | | NULL | |
    Address1 | char(30) | YES | | NULL | |
    PostCode | char(10) | YES | | NULL | |
    Town | int(11) | YES | | NULL | |
    +-----------+----------+------+-----+---------+----------------+

    Cheers, Ron.
    --
    Bruce Momjian | http://candle.pha.pa.us
    pgman@candle.pha.pa.us | (610) 853-3000
    + If your life is a hard drive, | 830 Blythe Avenue
    + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
  • Joel Burton at Oct 19, 2001 at 3:35 pm

    On Fri, 19 Oct 2001, Ron de Jong wrote:

    Any idea to get a human readable list with column descriptions like
    type,size,key,default,null.
    It would be nice if it would look simular to the mysql variant:

    mysql> describe employee;
    +-----------+----------+------+-----+---------+----------------+
    Field | Type | Null | Key | Default | Extra |
    +-----------+----------+------+-----+---------+----------------+
    Id | int(11) | | PRI | NULL | auto_increment |
    FirstName | char(30) | | MUL | | |
    LastName | char(30) | | | | |
    Infix | char(10) | YES | | NULL | |
    Address1 | char(30) | YES | | NULL | |
    PostCode | char(10) | YES | | NULL | |
    Town | int(11) | YES | | NULL | |
    +-----------+----------+------+-----+---------+----------------+
    Easily done -- look at the \d commands in psql or \h to get help
    in psql. This is a FAQ -- STFW.

    BTW, the -hackers list is for tricky questions requiring experienced
    developer help, or for discussion among the gurus. Please post
    general questions to pgsql-general or pgsql-novice and re-post
    to pgsql-hackers only if you get no response w/in a week.

    HTH,
    --

    Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton
    Independent Knowledge Management Consultant
  • Roland Roberts at Oct 23, 2001 at 8:22 pm
    "Ron" == Ron de Jong writes:
    Ron> Any idea to get a human readable list with column
    Ron> descriptions like type,size,key,default,null.

    Ron> It would be nice if it would look simular to the mysql
    Ron> variant:

    You'll need to write your own query to get it to look like mysql.
    From psql, you can do

    \d employee

    roland
    --
    PGP Key ID: 66 BC 3B CD
    Roland B. Roberts, PhD RL Enterprises
    roland@rlenter.com 76-15 113th Street, Apt 3B
    roland@astrofoto.org Forest Hills, NY 11375

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedOct 19, '01 at 11:35a
activeOct 26, '01 at 10:05a
posts12
users7
websitepostgresql.org...
irc#postgresql

People

Translate

site design / logo © 2021 Grokbase