pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: knut.suebert@web.de
To: pgsql-php@postgresql.org <pgsql-php@postgresql.org>
Subject: Re: How can I get metadate of a table in PHP3?
Date: Mon, 2 Sep 2002 21:44:13 +0200
Message-ID: <20020902194412.GA657@fraxinus.reticulum> (raw)
In-Reply-To: <3D71AF16.E4216C05@cs.nmsu.edu>
References: <3D71AF16.E4216C05@cs.nmsu.edu>

Zhidian Du schrieb:

> How can I get metadate of a table in PHP3?

If you think about things like the output of "\d tablename", turn on
the logging of queries, do a "\d tablename" and watch the
logfiles.

Somewhere I need the fieldtypes of a table named $this->table, the
query is

      $q = "SELECT a.attname, format_type(a.atttypid, a.atttypmod)
        FROM pg_class c, pg_attribute a
        WHERE c.relname = '".$this->table."'
        AND a.attnum > 0 AND a.attrelid = c.oid
        ORDER BY a.attnum";

which is stolen from the logs - I'll never understand it ;)

Greetings,
Knut Sübert



view thread (4+ messages)  latest in thread

Message-ID: <20020902194412.GA657@fraxinus.reticulum>
Permalink:  ../20020902194412.GA657@fraxinus.reticulum/
Also on:    postgresql.org/message-id/20020902194412.GA657@fraxinus.reticulum

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: knut.suebert@web.de
  Subject: Re: How can I get metadate of a table in PHP3?
  In-Reply-To: <20020902194412.GA657@fraxinus.reticulum>
  References: <3D71AF16.E4216C05@cs.nmsu.edu> <20020902194412.GA657@fraxinus.reticulum>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox