X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7C05D5406B for ; Sun, 24 Apr 2005 17:26:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78928-08 for ; Sun, 24 Apr 2005 20:26:16 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8BDBD53D0E for ; Sun, 24 Apr 2005 17:24:00 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 6AE8430E89; Sun, 24 Apr 2005 22:22:40 +0200 (MET DST) From: Andrew - Supernews X-Newsgroups: pgsql.sql Subject: Re: Matching the MYSQL "Describe " command Date: Sun, 24 Apr 2005 20:24:00 -0000 Organization: http://www.supernews.com - all your nntp are belong to us Message-ID: References: <200504241902.16770.alan@chandlerfamily.org.uk> Reply-To: andrew@supernews.com User-Agent: slrn/0.9.8.0 (FreeBSD) X-Complaints-To: abuse@supernews.com Lines: 20 To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/369 X-Sequence-Number: 21262 On 2005-04-24, Alan Chandler wrote: > I am rather new to Postgres (running 7.4) but I am trying to port some PHP > code that has been built to run with mysql. > > I have got stuck trying to find the equivalent of the Mysql "DESCRIBE >;" SQL statement that lists the columns and type identifiers of a > table. > > I think I am going to do a SELECT on the "pg_attribute" table, Steer clear of reading the system catalogs directly; getting the right answers from them can be much harder than it appears, since they are organized purely for the convenience of the backend. For this specific task, information_schema.columns should be pretty close to what you need. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services