-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renames views; Adds Dependencies view (#14)
Renames views; Adds Dependencies view
- Loading branch information
Showing
8 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
select | ||
classid | ||
, objid | ||
, objsubid | ||
, refclassid | ||
, refobjid | ||
, refobjsubid | ||
, deptype | ||
from pg_depend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{# SOURCE: https://github.com/awslabs/amazon-redshift-utils/blob/master/src/AdminViews/v_view_dependency.sql #} | ||
|
||
select distinct | ||
srcobj.oid as source_oid | ||
, srcnsp.nspname as source_schemaname | ||
, srcobj.relname as source_objectname | ||
, tgtobj.oid as dependent_oid | ||
, tgtnsp.nspname as dependent_schemaname | ||
, tgtobj.relname as dependent_objectname | ||
|
||
from | ||
|
||
{{ ref('pg_class') }} as srcobj | ||
join {{ ref('pg_depend') }} as srcdep on srcobj.oid = srcdep.refobjid | ||
join {{ ref('pg_depend') }} as tgtdep on srcdep.objid = tgtdep.objid | ||
join {{ ref('pg_class') }} as tgtobj | ||
on tgtdep.refobjid = tgtobj.oid | ||
and srcobj.oid <> tgtobj.oid | ||
left join {{ ref('pg_namespace') }} as srcnsp | ||
on srcobj.relnamespace = srcnsp.oid | ||
left join {{ ref('pg_namespace') }} tgtnsp on tgtobj.relnamespace = tgtnsp.oid | ||
|
||
where | ||
tgtdep.deptype = 'i' --dependency_internal | ||
and tgtobj.relkind = 'v' --i=index, v=view, s=sequence |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.