You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In general Postgres ranges do not have the concept of PosInfinity or NegInfinity. So it would be preferable for these to be replaced with a singe constructor which could be called Unbound. This would have the appealing property of disallowing obviously nonsensical values like. (+infinity,-infinity)
some element types have a notion of “infinity”, but that is just another value so far as the range type mechanisms are concerned. For example, in timestamp ranges, [today,] means the same thing as [today,). But [today,infinity] means something different from [today,infinity) — the latter excludes the special timestamp value infinity.
The text was updated successfully, but these errors were encountered:
Well, PGRange PosInfinity NegInfinity is a perfectly sensible value, and will be rendered to postgresql as 'empty'. In fact, that's actually the definition of empty in postgresql-simple. The range module itself will never produce either +infinity or -infinity in a postgresql value, but rather translate that to an appropriate syntax.
You might want to look at the actual implementation of this module.
That does not seem like "sensible value" to me. It has no reasonable interpretation as a range. Postgres does the reasonable thing and rejects something like that, even for range types that do happen to have infinities.
Ive glanced in the module. My interest is mainly as a user of the library and I don't have much knowledge of the internals. I don't claim the library generates invalid SQL, but I claim the data type that's exposed is the wrong one. I think its important that types accurately reflect what they do, and in particular here the type that leads one to wrong conclusions about the Postgres feature it represents, as it did for me.
Is there some benefit to choosing this representation that does not correspond to the values that Postgres actually supports? I have a hard time imagining one.
I appreciate the library, and don't mean to imply an imposition on your time. I would consider writing a patch sometime if it would be accepted. If not I'm interested in the reasoning.
RangeBound
has too many constructors.In general Postgres ranges do not have the concept of
PosInfinity
orNegInfinity
. So it would be preferable for these to be replaced with a singe constructor which could be calledUnbound
. This would have the appealing property of disallowing obviously nonsensical values like.(+infinity,-infinity)
From the relevant portion of the documentation
The text was updated successfully, but these errors were encountered: