[Haskell-cafe] Handling Postgresql array types

info at rotnetix.com info at rotnetix.com
Mon Dec 29 02:57:49 UTC 2014


Thank you, it works now.  I know that it is not advisable to use column 
names like this, sadly by the time I got involved the DB schema was fixed.

On Monday, December 29, 2014 12:39:27 AM UTC+11, Tom Ellis wrote:
>
> On Sat, Dec 27, 2014 at 05:56:28PM -0800, in... at rotnetix.com <javascript:> 
> 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 
> _______________________________________________ 
> Haskell-Cafe mailing list 
> Haskel... at haskell.org <javascript:> 
> http://www.haskell.org/mailman/listinfo/haskell-cafe 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141228/04db2fda/attachment-0001.html>


More information about the Haskell-Cafe mailing list