> 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
-