We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 779024d commit 4337eb2Copy full SHA for 4337eb2
internal/dialect/dialectquery/postgres.go
@@ -50,7 +50,7 @@ func (p *Postgres) TableExists(tableName string) string {
50
q := `SELECT EXISTS ( SELECT 1 FROM pg_tables WHERE schemaname = '%s' AND tablename = '%s' )`
51
return fmt.Sprintf(q, schemaName, tableName)
52
}
53
- q := `SELECT EXISTS ( SELECT 1 FROM pg_tables WHERE tablename = '%s' )`
+ q := `SELECT EXISTS ( SELECT 1 FROM pg_tables WHERE (current_schema() IS NULL OR schemaname = current_schema()) AND tablename = '%s' )`
54
return fmt.Sprintf(q, tableName)
55
56
0 commit comments