-
-
Notifications
You must be signed in to change notification settings - Fork 250
fix: pgdialect range #1221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix: pgdialect range #1221
Conversation
23c9808
to
e50737c
Compare
dialect/pgdialect/range.go
Outdated
return Array(m).Scan(anySrc) | ||
} | ||
|
||
func (m MultiRange[T]) AppendQuery(fmt schema.Formatter, buf []byte) ([]byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I move this logic to not have quote for Range inside array ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to specifically test which form PostgreSQL can accept, as this is a complex and uncommon case.
dialect/pgdialect/range.go
Outdated
RangeBoundInclusiveRight RangeBound = ']' | ||
RangeBoundExclusiveLeft RangeBound = '(' | ||
RangeBoundExclusiveRight RangeBound = ')' | ||
RangeLowerBoundInclusive RangeLowerBound = '[' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really have to rename these variable?
The original name may not be perfect, but changing it would break backward compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can keep the same name, but I think it's preferable to keep a different type between lower and upper bound
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good I rb to the previous naming
dialect/pgdialect/range.go
Outdated
|
||
if len(src) == 0 { | ||
return io.ErrUnexpectedEOF | ||
src, err = scanElem(&r.Upper, src) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to consider a comma here? I’m not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I improved the tests with equality, I also switch to a driver.valuer so we don't need to remove '
Thank you for your contribution, especially the related test cases. |
Thx for your feedbacks ! With this new updates this should be better for multirange |
there is also |
Hello,
I suggest a fixes on
pgdialect.Range
, on a pg14.Doc: https://www.postgresql.org/docs/current/rangetypes.html
Thx !