[Haskell-cafe] Handling Postgresql array types
Tom Ellis
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Sun Dec 28 13:39:16 UTC 2014
On Sat, Dec 27, 2014 at 05:56:28PM -0800, info at rotnetix.com wrote:
> The other issue I had is once the array select is working is how to select
> a column with a special name... For some reason out DB designer decided
> that one of the columns should be named "column". Which is a pain anyway
> but in normal SQL you can deal with that by selecting it fully qualified as
> in arrayTable.column but if I try that in opaleye, like:
>
> table = Table "arraytable" (required "arraytable.column")
>
> the query complains:
> *** Exception: SqlError {sqlState = "42601", sqlExecStatus = FatalError,
> sqlErrorMsg = "syntax error at or near \".\"", sqlErrorDetail = "",
> sqlErrorHint = ""}
This is now fixed in master
https://github.com/tomjaguarpaw/haskell-opaleye/commit/3d9946f3f9ea912aa320ed7908357fe3a62dad5f
`required "column"` will work (not `required "arraytable.column"`)
I fixed it by wrapping column names in double quotes, not by qualifying the
names. You yourself may find the former nicer when you write raw SQL.
As an aside, using column names that are keywords or not alphanumeric seems
to me to be playing with bees (like playing with fire, but more annoying
than dangerous).
Tom
More information about the Haskell-Cafe
mailing list