Skip to content

Commit

Permalink
Simplify tablename passing
Browse files Browse the repository at this point in the history
  • Loading branch information
Raveline committed Oct 10, 2024
1 parent e0e49a6 commit 2d26819
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Database/PostgreSQL/PQTypes/Checks.hs
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ checkDBStructure options tables = fmap mconcat . forM tables $ \(table, version)
runQuery_ $ sqlGetForeignKeys table
fkeys <- fetchMany fetchForeignKey
triggers <- getDBTriggers tblName
checkedOverlaps <- checkOverlappingIndexes (mkSQL . T.pack $ tblNameString table)
checkedOverlaps <- checkOverlappingIndexes tblName
return $
mconcat
[ checkColumns 1 tblColumns desc
Expand Down Expand Up @@ -714,7 +714,7 @@ checkDBStructure options tables = fmap mconcat . forM tables $ \(table, version)
\expected output into source code.)"
]

checkOverlappingIndexes :: MonadDB m => SQL -> m ValidationResult
checkOverlappingIndexes :: MonadDB m => RawSQL () -> m ValidationResult
checkOverlappingIndexes tableName =
if eoCheckOverlappingIndexes options
then go
Expand Down
4 changes: 2 additions & 2 deletions src/Database/PostgreSQL/PQTypes/Checks/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ objectHasMore otype ptype extra =
arrListTable :: RawSQL () -> Text
arrListTable tableName = " ->" <+> unRawSQL tableName <> ": "

checkOverlappingIndexesQuery :: SQL -> SQL
checkOverlappingIndexesQuery :: RawSQL () -> SQL
checkOverlappingIndexesQuery tableName =
smconcat
[ "WITH"
Expand All @@ -202,7 +202,7 @@ checkOverlappingIndexesQuery tableName =
, " , 'WHERE (.*)$')))[1] AS preddef"
, " FROM pg_index"
, " WHERE indexprs IS NULL"
, " AND indrelid = '" <> tableName <> "'::regclass)"
, " AND indrelid = '" <> raw tableName <> "'::regclass)"
, -- add the rest of metadata and do the join
" , indexdata2 AS (SELECT t1.*"
, " , pg_get_indexdef(t1.indexrelid) AS contained"
Expand Down

0 comments on commit 2d26819

Please sign in to comment.