key returns a canonical kind-prefixed identifier used for dependency lookups and set membership. Tables, views, and matviews share a namespace (relation namespace in PG), so they use the same prefix "rel:". Functions are identified by schema, name AND signature so that overloaded names (e.g. `publi
()
| 86 | // names (e.g. `public.fn(int4)` and `public.fn(text)`) do not collide and |
| 87 | // collapse into a single entry during topo-sort bookkeeping. |
| 88 | func (e *objectEntry) key() string { |
| 89 | switch e.kind { |
| 90 | case kindSchema: |
| 91 | return "schema:" + e.schema |
| 92 | case kindEnum: |
| 93 | return "type:" + e.schema + "." + e.name |
| 94 | case kindTable, kindView, kindMatView: |
| 95 | return "rel:" + e.schema + "." + e.name |
| 96 | case kindFunction: |
| 97 | return "func:" + e.schema + "." + e.name + "|" + funcSignatureKey(e.funcMeta) |
| 98 | } |
| 99 | return "unknown:" + e.schema + "." + e.name |
| 100 | } |
| 101 | |
| 102 | // sortKey returns the intra-SCC lexicographic key. Matches hard contract C10. |
| 103 | // For functions the signature is appended so overloads have distinct sort |