db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Jefferson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JDO-721) Specifying NULL elements positioning in ordered columns
Date Mon, 29 Jul 2013 14:19:49 GMT

    [ https://issues.apache.org/jira/browse/JDO-721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13722479#comment-13722479
] 

Andy Jefferson commented on JDO-721:
------------------------------------

DataNucleus 3.2/3.3 (SVN) supports an ordering clause (in JDOQL/JPQL) of
"ORDER BY  fieldName [ASC | DESC]  [NULLS FIRST | NULLS LAST], ..."
which reflects what ANSI SQL has. Obviously not all RDBMS provide for it, but it's there for
those that do (H2, HSQLDB, Derby, PostgreSQL, DB2, Oracle). MySQL doesn't follow the ANSI
spec so isn't supported (but then anybody could contribute support for it, heh)
                
> Specifying NULL elements positioning in ordered columns
> -------------------------------------------------------
>
>                 Key: JDO-721
>                 URL: https://issues.apache.org/jira/browse/JDO-721
>             Project: JDO
>          Issue Type: Improvement
>          Components: specification
>    Affects Versions: JDO 3 update 1 (3.0.1)
>            Reporter: Muhammad Gelbana
>            Priority: Minor
>              Labels: jdoql
>
> I don't know about other RDBMS but in MySQL ordering, it's possible to specify whether
NULL column fields are placed in the beginning or at the end of the ordering, i.e.:
> ORDER BY `values_column` IS NULL DESC
> [values_column]
> NULL
> NULL
> value1
> value2
> value3
> or the other way around (ORDER BY `values_column` IS NULL ASC):
> [values_column]
> value1
> value2
> value3
> NULL
> NULL
> I checked JDO 3 specification and found that JDOQL's ordering specification doesn't support
specifying NULL values handling:
> ------------------------------------------------------------------------------
> 26.7 Ordering Specification
> This section describes the syntax of the setOrdering argument.
>     OrderingClause:
>         OrderingSpecs ,opt
>     OrderingSpecs:
>         OrderingSpec
>         OrderingSpecs , OrderingSpec
>     OrderingSpec:
>         Expression Ascending
>         Expression Descending
>     Ascending: one of
>         asc ascending
>     Descending: one of
>         desc descending
> Please note, as a usability feature OrderingClause supports an optional trailing comma.
> ------------------------------------------------------------------------------
> Thank you for your time and efforts.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message