Bug in psql (\dd query)
От | Ivan Radovanovic |
---|---|
Тема | Bug in psql (\dd query) |
Дата | |
Msg-id | 5214891A.3000804@gmail.com обсуждение исходный текст |
Ответы |
Re: Bug in psql (\dd query)
|
Список | pgsql-general |
Hello, I was checking for way to get object comments, and it seems that \dd has bug when it comes to extracting descriptions for constraints. Relevant part of query psql is executing is: SELECT DISTINCT tt.nspname AS "Schema", tt.name AS "Name", tt.object AS "Object", d.description AS "Description" FROM ( SELECT pgc.oid as oid, pgc.tableoid AS tableoid, n.nspname as nspname, CAST(pgc.conname AS pg_catalog.text) as name, CAST('constraint' AS pg_catalog.text) as object FROM pg_catalog.pg_constraint pgc JOIN pg_catalog.pg_class c ON c.oid = pgc.conrelid LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname <> 'pg_catalog' AND n.nspname <> 'information_schema' AND pg_catalog.pg_table_is_visible(c.oid) /* more unions here */ ) AS tt JOIN pg_catalog.pg_description d ON (tt.oid = d.objoid AND tt.tableoid = d.classoid AND d.objsubid = 0) ORDER BY 1, 2, 3; obviously it is trying to get description for (table_oid, constraint_oid, 0), while in fact it should read description for (oid of pg_catalog.pg_constaint, constraint_oid, 0). At least last tuple is what comment statement is inserting into pg_description table Regards, Ivan
В списке pgsql-general по дате отправления: