Re: programatically obtaining table layout

From: "Mark McEahern" <marklists(at)mceahern(dot)com>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: programatically obtaining table layout
Date: 2002-08-29 12:50:41
Message-ID: JHEOKEOOLIGLDHCMAHMOMEBFDLAA.marklists@mceahern.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

-

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Gaetano Mendola 2002-08-29 14:06:40 Re: Errors with pg_dump
Previous Message Bhuvan A 2002-08-29 09:57:31 Re: How can I Delete/Alter Unique Constraint