Anasayfa / Database / Postgresql / postgresql find dependent object

postgresql find dependent object

https://stackoverflow.com/questions/4462908/find-dependent-objects-for-a-table-or-view

 

SELECT dependent_ns.nspname as dependent_schema
, dependent_view.relname as dependent_view
, source_ns.nspname as source_schema
, source_table.relname as source_table
, pg_attribute.attname as column_name
FROM pg_depend
JOIN pg_rewrite ON pg_depend.objid = pg_rewrite.oid
JOIN pg_class as dependent_view ON pg_rewrite.ev_class = dependent_view.oid
JOIN pg_class as source_table ON pg_depend.refobjid = source_table.oid
JOIN pg_attribute ON pg_depend.refobjid = pg_attribute.attrelid
    AND pg_depend.refobjsubid = pg_attribute.attnum
JOIN pg_namespace dependent_ns ON dependent_ns.oid = dependent_view.relnamespace
JOIN pg_namespace source_ns ON source_ns.oid = source_table.relnamespace
WHERE
source_ns.nspname = 'public'
--AND source_table.relname = 'ulke_kodlari'
AND pg_attribute.attnum > 0
--AND pg_attribute.attname = 'my_column'
ORDER BY 1,2;

 

Hakkında ibrahim

İlgili Makaleler

Postgresql gümrük beyanname tescil no regex domain

create domain dmn_tescilno varchar(16) check ( value ~ '^[0-9]{8}((IM)|(EX)|(AN)|(TR)|(DG)|(T0)|(C0)|(B0)|(G0)|(M0)|(R0)|(RL))[0-9]{6}$'); select '22222222AN111111'::dmn_tescilno;  

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir