Re: programatically obtaining table layout - Mailing list pgsql-admin

From Mark McEahern
Subject Re: programatically obtaining table layout
Date
Msg-id JHEOKEOOLIGLDHCMAHMOMEBFDLAA.marklists@mceahern.com
Whole thread Raw
In response to programatically obtaining table layout  ("Philip Rudling" <psr@clara.net>)
List pgsql-admin
> Is there a way of getting the output of a \d tablename  from within a
> program (like describe in mysql)

If I understand your question correctly, you mean how do I do what this
does:

  psql -c "\d $tablename" $dbname $username

Try this:

  psql --help

Notice the -E option:

  -E              Display queries that internal commands generate

So:

  psql -c "\d $tablename" -E $dbname $username

Cheers,

// mark

-


pgsql-admin by date:

Previous
From: Merlita Maricuelo
Date:
Subject: unable to reconnect to database server
Next
From: Tom Lane
Date:
Subject: Re: Time slowly goes out of sync Cygwin+windows+psotgres