lpsmith / postgresql-simple

Mid-level client library for accessing PostgreSQL from Haskell
Other
206 stars 71 forks source link

Extend ToRow and FromRow to tuples of size 18 #229

Closed BardurArantsson closed 6 years ago

BardurArantsson commented 6 years ago

(I've taken the liberty of including the GHC 7.6.x commit in this just to avoid the spurious Travis CI error. Feel free to drop that commit if you want to.)

I realize that tuples of this size aren't exactly ideal, but I'm actually hitting the rather low limit in UPSERT-style scenarios where the number of query parameters are usually about double that of normal queries. I'd rather not have to write newtypes for single queries :).

lpsmith commented 6 years ago

Not opposed, though you can use :. or the generic instances in your own records/newtypes. Also, 18 is a slightly odd limit, maybe 20?

BardurArantsson commented 6 years ago

Sure, we can do 20 :). I actually just chose 18 just for the aesthetics of the last entry :).

I'll do a follow-up with 20 in a bit.

(Hadn't noticed the :. thing, perhaps I should actually be using that...)

lpsmith commented 6 years ago

Well, if you like the aesthetics, maybe we could go to 24 or 30, which are very round numbers (IMO). But maybe we would be getting carried away at that point?

BardurArantsson commented 6 years ago

20 it is :).

BardurArantsson commented 6 years ago

Branch updated, incidentally also discovered that I'd missed an 'intermediat-sized' instance of FromRow.

BardurArantsson commented 6 years ago

Should be fixed now, thanks :).