tablemeta-data

Started by Erik Pricealmost 23 years ago4 messagesgeneral
Jump to latest
#1Erik Price
eprice@ptc.com

Hi,

Is there a way to execute a query that returns meta-data about the
tables? Specifically I am interested in a psql command to display
information about a table's column names and types.

I have moved from MySQL to PostgreSQL to expand my horizons but the SHOW
DATABASES and DESCRIBE some_table commands are the ones I find myself
missing the most. Perhaps there's some SQL that approximates it.

Thanks,

Erik

#2Bruno Wolff III
bruno@wolff.to
In reply to: Erik Price (#1)
Re: tablemeta-data

On Thu, May 22, 2003 at 12:58:21 -0400,
Erik Price <eprice@ptc.com> wrote:

Hi,

Is there a way to execute a query that returns meta-data about the
tables? Specifically I am interested in a psql command to display
information about a table's column names and types.

\d table_name

Use \? to get a list of \ commands.

#3Jim Nasby
Jim.Nasby@BlueTreble.com
In reply to: Erik Price (#1)
Re: tablemeta-data

Have you tried \l and \d in psql?

See also
http://www.postgresql.org/docs/view.php?version=7.3&amp;idoc=0&amp;file=catalogs.html

On Thu, May 22, 2003 at 12:58:21PM -0400, Erik Price wrote:

Hi,

Is there a way to execute a query that returns meta-data about the
tables? Specifically I am interested in a psql command to display
information about a table's column names and types.

I have moved from MySQL to PostgreSQL to expand my horizons but the SHOW
DATABASES and DESCRIBE some_table commands are the ones I find myself
missing the most. Perhaps there's some SQL that approximates it.

Thanks,

Erik

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

--
Jim C. Nasby (aka Decibel!) jim@nasby.net
Member: Triangle Fraternity, Sports Car Club of America
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

#4Erik Price
eprice@ptc.com
In reply to: Bruno Wolff III (#2)
Re: tablemeta-data

Bruno Wolff III wrote:

On Thu, May 22, 2003 at 12:58:21 -0400,
Erik Price <eprice@ptc.com> wrote:

Hi,

Is there a way to execute a query that returns meta-data about the
tables? Specifically I am interested in a psql command to display
information about a table's column names and types.

\d table_name

Use \? to get a list of \ commands.

Thanks everyone for these commands. I thought I had read through the
options in "\?" but guess I didn't look too closely. This is exactly
what I was looking for.

Regards,

Erik