Re: is there any query so that I may find the list of columns those have rules?

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: is there any query so that I may find the list of columns those have rules?
Дата
Msg-id D960CB61B694CF459DCFB4B0128514C2081BE48C@exadv11.host.magwien.gv.at
обсуждение исходный текст
Ответ на is there any query so that I may find the list of columns those have rules?  (AI Rumman <rummandba@gmail.com>)
Список pgsql-general
AI Rumman wrote:
> I am getting the following error:
> ALTER TABLE base_table ALTER COLUMN base_table_field1 TYPE
numeric(10,6);
> ERROR:  cannot alter type of a column used by a view or rule
> DETAIL:  rule _RETURN on view master_view depends on column
"base_table_field1"
>
> I know that I have a view based in the "base_table_field1" column.
>
> So is there any query so that I may find the list of columns those
have rules?

Does this help:

SELECT d1.refobjid::regclass AS table,
       a.attname AS column,
       d2.refobjid::regclass AS "referenced by view"
FROM pg_depend d1
JOIN pg_depend d2 ON (d1.objid = d2.objid
                AND d1.classid = 'pg_rewrite'::regclass
                AND d1.refclassid ='pg_class'::regclass
                AND d2.classid = 'pg_rewrite'::regclass
                AND d2.refclassid = 'pg_class'::regclass
                AND d2.deptype='i')
JOIN pg_attribute a ON (d1.refobjid = a.attrelid
                AND d1.refobjsubid = a.attnum)
WHERE d1.refobjid='base_table'::regclass
ORDER BY 1, 2, 3;

Yours,
Laurenz Albe

В списке pgsql-general по дате отправления:

Предыдущее
От: raghu ram
Дата:
Сообщение: Re: Is there a way to recover deleted records if database has not been vacuumed?
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: Is there a way to recover deleted records if database has not been vacuumed?