Closed matthewmcgarvey closed 3 years ago
This is related to https://github.com/will/crystal-pg/pull/89 which is attempting a more complete implementation laid out here https://github.com/will/crystal-pg/issues/43#issuecomment-221906216 but stalled out.
Thanks! This looks good to me. I don’t myself use citext though, so I'm going to leave this open for a couple of days in case anyone has comments. But I expect to merge this, then do a release sometime early next week.
Oh! I remember. Double check that when using rs.read(String?)
the conversion will work. It will probably wont. In crystal-sqlite3 there are a couple of these IIRC.
Thanks!
Fixes #43
In order to support the citext extension in Avram, we need to be able to treat the column as a String. Two solutions were laid out in the connected issue:
rs.read(String)
on a string-like column (citext, enum or similar), it should return a String.rs.read
on a string-like column, it should probably also return a String.B was considered the more "complete solution" but also the more complicated. Since it's been 4 years since the issue was opened and over a year since the potential solutions were laid out, I went with the more immediate option A. If the read type is
Slice(UInt8)
, which is the type of a citext column, and#read
was called with a type ofString
, then convert it to String. This helps with citext interop and I'm sure it helps with other column types as well.