Skip to content

Commit f7d3d64

Browse files
committed
Document non-reserved keyword behaviour
1 parent 48aee7e commit f7d3d64

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • src/Database/PostgreSQL/PQTypes/Model

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ instance Ord IndexColumn where
6565
instance IsString IndexColumn where
6666
fromString s = IndexColumn (fromString s) Nothing
6767

68+
-- | Build an 'IndexColumn' from a column name.
69+
--
70+
-- If the column name is a non-reserved keyword in PostgreSQL it must be given
71+
-- double-quoted, e.g.
72+
--
73+
-- @timestamp@ -> @\"\\\"timestamp\\\"\"@
74+
--
75+
-- PostgreSQL stores the index definition with the keyword quoted, so the column
76+
-- name passed here has to match that exactly or the database consistency check
77+
-- will report a mismatch.
6878
indexColumn :: RawSQL () -> IndexColumn
6979
indexColumn col = IndexColumn col Nothing
7080

0 commit comments

Comments
 (0)