Fix a bug in the column constraint detection
- Without the table constraint any table in the DB that was named the same as another would trigger false positives.
This commit is contained in:
parent
71dc36c8e6
commit
423d4b66bf
1 changed files with 1 additions and 1 deletions
|
@ -86,7 +86,7 @@ func (p *PostgresDriver) Columns(tableName string) ([]bdb.Column, error) {
|
|||
select cast(count(*) as bit) as is_unique
|
||||
from information_schema.constraint_column_usage as ccu
|
||||
inner join information_schema.table_constraints tc on ccu.constraint_name = tc.constraint_name
|
||||
where ccu.column_name = c.column_name and tc.constraint_type = 'UNIQUE'
|
||||
where ccu.table_name = c.table_name and ccu.column_name = c.column_name and tc.constraint_type = 'UNIQUE'
|
||||
) as is_unique
|
||||
from information_schema.columns as c
|
||||
where table_name=$1 and table_schema = 'public';
|
||||
|
|
Loading…
Add table
Reference in a new issue