[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-465) order by nulls first / last
Steve Ebersole (JIRA)
noreply at atlassian.com
Fri Apr 24 22:25:18 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33012#action_33012 ]
Steve Ebersole commented on HHH-465:
------------------------------------
In the interest of completeness, it is actually the SQL-2003 spec which introduces NULLS FIRST | NULLS LAST.
Also, it does not define the "sort key" as simply as [COLUMN NAME]. In SQL-92 it was the case that a sort-key could only be (a) column name or (b) integer literal (indicating the select-clause position). For SQL-2003 (and SQL-99), the full definition of sort key is:
<sort key> ::= <value expression>
essentially anything that resolves to a value (see http://savage.net.au/SQL/sql-2003-2.bnf.html#sort%20key for details)
The difficulty here is if we are going to support SQL-2003 then we need to support its full breadth. Which implies an audit to see what databases fully comply with the various SQL-2003 defined compatibility levels.
> order by nulls first / last
> ---------------------------
>
> Key: HHH-465
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-465
> Project: Hibernate Core
> Issue Type: Improvement
> Components: core
> Affects Versions: 3.0.3
> Reporter: Anthony Patricio
> Priority: Minor
> Attachments: CustomNullsFirstInterceptor.java
>
>
> support of nulls first / last in order clause
> "NULLS LAST" is part of the SQL 99 standard.
> The syntax is as follows:
> ORDER BY [COLUMN NAME] [ASC | DESC] [NULLS FIRST | NULLS LAST]
> In different DBs, the sorting of nulls relative to other values is handled differently.
> PostgreSQL - Nulls are considered HIGHER than non-nulls.
> DB2 - Higher
> MSSQL - Lower
> MySQL - Lower
> Oracle - Higher
> The following DBs have supported this functionality:
> DB2 V7
> Oracle 9i
> PostgreSQL, MySQL, SQLServer do not appear to support this from what I can gather.
> see http://forum.hibernate.org/viewtopic.php?t=942176&start=0&postdays=0&postorder=asc&highlight=
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list