Skip to content

Commit f8434be

Browse files
committed
fix(table): use or for table relationships
1 parent 82ae355 commit f8434be

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/lib/sql/table.sql.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@ FROM
8080
join pg_namespace nta on cta.relnamespace = nta.oid
8181
) on ta.attrelid = c.confrelid and ta.attnum = any (c.confkey)
8282
where
83-
${props.schemaFilter ? `nsa.nspname ${props.schemaFilter} AND` : ''}
84-
${props.schemaFilter ? `nta.nspname ${props.schemaFilter} AND` : ''}
85-
${props.tableIdentifierFilter ? `nsa.nspname || '.' || csa.relname ${props.tableIdentifierFilter} AND` : ''}
86-
${props.tableIdentifierFilter ? `nta.nspname || '.' || cta.relname ${props.tableIdentifierFilter} AND` : ''}
83+
${props.schemaFilter ? `nsa.nspname ${props.schemaFilter} OR nta.nspname ${props.schemaFilter} AND` : ''}
84+
${props.tableIdentifierFilter ? `(nsa.nspname || '.' || csa.relname) ${props.tableIdentifierFilter} OR (nta.nspname || '.' || cta.relname) ${props.tableIdentifierFilter} AND` : ''}
8785
c.contype = 'f'
8886
) as relationships
8987
on (relationships.source_schema = nc.nspname and relationships.source_table_name = c.relname)

0 commit comments

Comments
 (0)