How to get table definition of a PostgreSQL table? I would like to get field's name, datatype of each field, length of each field and precision of each field of a PostgreSQL table. Please let me SQL query to get this information.
I suggest you use pg_dump to get tables' and views' definition, it's more convenient. The following command gets the definition of the database francs.

pg_dump -h 127.0.0.1 -E UTF8 -s -v francs &gt; francs.ddl


-s means only dump matching  schema, not data.