Get rid of legacy temporal extract functions #4745
Replies: 3 comments 20 replies
-
I'm guessing that you have no concrete example of this, right? However, I do agree that it is reasonable to use the database's specific function if it defines one ( As for specifics, it is |
Beta Was this translation helpful? Give feedback.
-
It's an unfortunate, albeit understandable, choice of function names when more than one database defines explicit functions with those names. So then what are your words of advice for existing applications that want
That is simply using different words for exactly what I said. "Yes" is perfectly acceptable and more succinct ;) |
Beta Was this translation helpful? Give feedback.
-
To resolve this, I believe we should just use the form which gives consistency across all databases (aka the generalized Unless I am mistaken, I think that is what y'all believe as well. |
Beta Was this translation helpful? Give feedback.
-
I just realized that in dialects we still register the legacy temporal extract functions:
year
month
day
hour
minute
second
week
quarter
although in the parser we interpret uses like
second(..)
asextract(second from ..)
, so the functions that dialects register through:org.hibernate.dialect.function.CommonFunctionFactory#weekQuarter
org.hibernate.dialect.function.CommonFunctionFactory#hourMinuteSecond
org.hibernate.dialect.function.CommonFunctionFactory#yearMonthDay
are never called. We should either stop interpreting
second(..)
asextract(second from ..)
or remove the unnecessary function registrations.Note that functions in databases like e.g.
second(..)
might have a different return type thanextract(second from ..)
which can lead to some surprises when users want to use the native function.Beta Was this translation helpful? Give feedback.
All reactions