sb_get_child_tables (public)

 sb_get_child_tables table_name [ html_anchor_p ]

Defined in packages/schema-browser/tcl/schema-browser-procs-postgresql.tcl

Build an HTML snippet listing all tables which have at least one foreign key referring to table_name.

Parameters:
table_name
html_anchor_p (defaults to "f")

Partial Call Graph (max 5 caller/called nodes):
%3 sb_get_table_description sb_get_table_description (public) sb_get_child_tables sb_get_child_tables sb_get_table_description->sb_get_child_tables db_foreach db_foreach (public) sb_get_child_tables->db_foreach

Testcases:
No testcase defined.
Source code:

    set return_string "\n\n-- Tables with foreign keys that refer to $table_name:"
    db_foreach schema_browser_get_referencess {
         select distinct r1.relname as child_table,
             conname as constraint_name
         from
             pg_trigger t,
             pg_class r,
             pg_class r1,
             pg_proc p,
             pg_constraint c
         where
             lower(r.relname) = lower(:table_name) and
             r.oid = t.tgconstrrelid and
             r1.oid = t.tgrelid and
             t.tgfoid = p.oid and
             c.conrelid  = r.oid and
             p.proname = 'RI_FKey_check_ins'
    } {
        if { $html_anchor_p == "t" } {
            append return_string "\n--<a href=\"index?table_name=$child_table\">[string tolower $child_table]</a>"
        } else {
            append return_string "\n--[string tolower $child_table]"
        }
        if { $constraint_name ne "<unnamed>" } {
            append return_string "($constraint_name)"
        }
    } if_no_rows {
        set return_string ""
    }
    return $return_string
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: