Estoy migrando un framework php que he desarrollado para mysql a postgresq
pero no logro averiguar como obtener los comentarios que se ponen a un campo
en una tabla. En mysql lo obtengo con "describe table". En postgresql he
conseguido esa informacion con una query que en encontrado en san google
SELECT
                                        a.attname AS Field,
                                        t.typname || '(' || a.atttypmod ||
')' AS Type,
                                        CASE WHEN a.attnotnull='t' THEN
'YES' ELSE 'NO' END as Null,
                                        CASE WHEN r.contype='p' THEN 'PRI'
ELSE '' END as Key,
                                        (SELECT
substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid), '\'(.*)\'')
                                           FROM pg_catalog.pg_attrdef d
                                           WHERE d.adrelid = a.attrelid AND
d.adnum = a.attnum AND a.atthasdef) AS Default,
                                        '' as Extras,
                                        '' as Comment,
                                        '' as Collation,
                                        '' as Privileges
                                    FROM
                                        pg_class c
                                        JOIN pg_attribute a ON a.attrelid =
c.oid
                                        JOIN pg_type t ON a.atttypid = t.oid
                                        LEFT JOIN pg_catalog.pg_constraint r
ON c.oid=r.conrelid
                                            AND r.conname = a.attname
                                    WHERE
                                        c.relname = '".$tabla."'
                                        and a.attnum > 0

Pero no logro encontrar donde rayos están los comentarios.
-- 
Salu2


Felipe Fernández
"Linux is for people who hate Windows, Debian is for people who love
Linux,".

"Documentation is like sex: when it is good, it is very, very good; and when
it is bad, it is better than nothing."

Responder a