On Wed, 20 Dec 2000, Vasiliu Constantin wrote:
> > daca ai sapat mai adanc si ai aflat raspunsul varsa-l si pe lista plz
>
> n-am sapat prea mult (~de loc) dar poti incepe asa :
>
> select attname,atttypid,attlen,atttypmod
> from pg_attribute
> where attrelid=(select oid
> from pg_class
> where relname='my_rel')
> order by attnum;
>
> Informatiile nu sunt explicite (pentru tip ai niste numere, ex
> :1042=char(), 701=float8,...Lungimea unui char() este attlen-4 si alte
> parascovenii, de aia spuneam ca ar trebui o functie sa le interpreteze
> si sa-ti scrie ceva inteligibil.
> Daca ai sursele de la pg poti sapa sa vezi cum fac ei comanda \d my_rel.
>
> </my poor answer>
Mersi de idee ... de fapt cred ca mai comod a fost sa ma uit in logul de
la postmaster cand dau comenzi de tipul `\d' din psql ... de ex am obtinut
urmatoarele:
/* ptr \dt */
SELECT c.relname as "Name", 'table'::text as "Type", u.usename as "Owner"
FROM pg_class c, pg_user u
WHERE c.relowner = u.usesysid AND c.relkind = 'r'
AND not exists (select 1 from pg_views where viewname = c.relname)
AND c.relname !~ '^pg_';
/* ptr \d my_table */
SELECT a.attname, t.typname, a.attlen, a.atttypmod, a.attnotnull,
a.atthasdef, a.attnum
FROM pg_class c, pg_attribute a, pg_type t
WHERE c.relname = 'my_table'
AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid
ORDER BY a.attnum;
hmmm interesant postgresul asta! muuult mai complex decat MySQL!!
---
Send e-mail to '[EMAIL PROTECTED]' with 'unsubscribe rlug' to
unsubscribe from this list.