Skip to content

Commit 3f6bb35

Browse files
committed
fixup! fixup! Normalize index identifiers on construction
1 parent dd8896e commit 3f6bb35

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

  • src/Database/PostgreSQL/PQTypes/Model

src/Database/PostgreSQL/PQTypes/Model/Index.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ indexNameWith mask tname TableIndex {..} =
218218
, maybe "" (("__" <>) . hashWhere) idxWhere
219219
]
220220
where
221+
asText f = flip rawSQL () . f . unRawSQL
221222
(colMask, incMask) = splitAt (length idxColumns) (mask ++ repeat False)
222223
renderIdent quoted ident =
223224
flip rawSQL () . sanitize $
@@ -235,13 +236,12 @@ indexNameWith mask tname TableIndex {..} =
235236
-- hash WHERE clause and add it to index name so that indexes
236237
-- with the same columns, but different constraints can coexist
237238
hashWhere =
238-
flip rawSQL ()
239-
. T.decodeUtf8
240-
. B16.encode
241-
. BS.take 10
242-
. RIPEMD160.hash
243-
. T.encodeUtf8
244-
. unRawSQL
239+
asText $
240+
T.decodeUtf8
241+
. B16.encode
242+
. BS.take 10
243+
. RIPEMD160.hash
244+
. T.encodeUtf8
245245

246246
-- | Create an index. Warning: if the affected table is large, this will prevent
247247
-- the table from being modified during the creation. If this is not acceptable,

0 commit comments

Comments
 (0)