[Haskell-cafe] Handling Postgresql array types

info at rotnetix.com info at rotnetix.com
Mon Dec 29 02:59:26 UTC 2014


I am curious as to how easy it will be for me to create a different mapping 
for PGArray, so that instead of (PGArray (PGArray PGFloat8)) -> [[Double]] 
I can do (PGArray (PGArray Float8)) -> Matrix Double.  It is not a big deal 
to do the conversion later but if the library allows that kind of thing to 
be easily done it can make the code more readable.

If opaleye is not really intended to do or if it is quite hard just let me 
know.

On Monday, December 29, 2014 1:57:49 PM UTC+11, in... at rotnetix.com wrote:
>
> 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 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 
>> 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/176f007d/attachment-0001.html>


More information about the Haskell-Cafe mailing list