Skip site navigation (1) Skip section navigation (2)

Re: Are there commands to enquire about table structure?

From: "Lee Harr" <missive(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Are there commands to enquire about table structure?
Date: 2004-01-31 02:22:09
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
>PostgreSQL mavens, can I ask the database, in a normal database query 
>command, or in other words,
>essentially using the same environment where I'd say...
>     SELECT count(*) FROM mytable [WHERE myconditions_obtain];
> get # records in my table,
>o How many fields mytable has as in:
>     SELECT fieldcount(*) from mytable

In 7.4 anyhow, I bet you can do much of this with the
information_schema. This one would be ...

SELECT count(*)
    FROM information_schema.columns
    WHERE table_name='mytable';

Add photos to your messages with MSN 8. Get 2 months FREE*.


pgsql-general by date

Next:From: Gregory WoodDate: 2004-01-31 03:18:49
Subject: Re: Two joins on same foreign key
Previous:From: Manuel TejadaDate: 2004-01-31 02:13:09
Subject: PostgreSQL 7.4.1 and

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group