You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Michael Neale (JIRA)" <ji...@apache.org> on 2008/07/08 07:22:31 UTC
[jira] Created: (JCR-1673) Date comparitons are backwards in SQL
query
Date comparitons are backwards in SQL query
-------------------------------------------
Key: JCR-1673
URL: https://issues.apache.org/jira/browse/JCR-1673
Project: Jackrabbit
Issue Type: Bug
Components: query
Affects Versions: core 1.4.1
Reporter: Michael Neale
Priority: Critical
Imagine there is a node with jcr:created of:
2008-07-08T15:10:07.125+10:00
The following query:
SELECT ... FROM .... WHERE jcr:created < '2008-07-09T14:55:29.774+10:00'
should return it, but it doesn't. However, if you put:
SELECT ... FROM .... WHERE jcr:created > '2008-07-09T14:55:29.774+10:00'
then it does return it. Whoops.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-1673) Date comparitons are backwards in
Queries
Posted by "Michael Neale (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611875#action_12611875 ]
Michael Neale commented on JCR-1673:
------------------------------------
Yes I have no idea - but now I know its doing a string comparison I am paying no attention to the result until I tell it it is a date.
That particular format of date is an ISO standard, I believe (but that doesn't answer your question).
> Date comparitons are backwards in Queries
> -----------------------------------------
>
> Key: JCR-1673
> URL: https://issues.apache.org/jira/browse/JCR-1673
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: core 1.4.1, core 1.4.4
> Reporter: Michael Neale
> Assignee: Jukka Zitting
> Priority: Critical
>
> Imagine there is a node with jcr:created of:
> 2008-07-08T15:10:07.125+10:00
> The following query:
> SELECT ... FROM .... WHERE jcr:created < '2009-07-08T15:10:07.125+10:00'
> should return it, but it doesn't. However, if you put:
> SELECT ... FROM .... WHERE jcr:created > '2009-07-08T15:10:07.125+10:00'
> then it does return it. Whoops.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-1673) Date comparitons are backwards in
Queries
Posted by "Michael Neale (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Neale updated JCR-1673:
-------------------------------
Affects Version/s: core 1.4.4
> Date comparitons are backwards in Queries
> -----------------------------------------
>
> Key: JCR-1673
> URL: https://issues.apache.org/jira/browse/JCR-1673
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: core 1.4.1, core 1.4.4
> Reporter: Michael Neale
> Priority: Critical
>
> Imagine there is a node with jcr:created of:
> 2008-07-08T15:10:07.125+10:00
> The following query:
> SELECT ... FROM .... WHERE jcr:created < '2009-07-08T15:10:07.125+10:00'
> should return it, but it doesn't. However, if you put:
> SELECT ... FROM .... WHERE jcr:created > '2009-07-08T15:10:07.125+10:00'
> then it does return it. Whoops.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-1673) Date comparitons are backwards in
Queries
Posted by "Michael Neale (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611523#action_12611523 ]
Michael Neale commented on JCR-1673:
------------------------------------
Ah thanks. that would explain it. I will have to find another explanation for my insanity.
> Date comparitons are backwards in Queries
> -----------------------------------------
>
> Key: JCR-1673
> URL: https://issues.apache.org/jira/browse/JCR-1673
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: core 1.4.1, core 1.4.4
> Reporter: Michael Neale
> Assignee: Jukka Zitting
> Priority: Critical
>
> Imagine there is a node with jcr:created of:
> 2008-07-08T15:10:07.125+10:00
> The following query:
> SELECT ... FROM .... WHERE jcr:created < '2009-07-08T15:10:07.125+10:00'
> should return it, but it doesn't. However, if you put:
> SELECT ... FROM .... WHERE jcr:created > '2009-07-08T15:10:07.125+10:00'
> then it does return it. Whoops.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-1673) Date comparitons are backwards in
Queries
Posted by "Michael Neale (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611458#action_12611458 ]
Michael Neale commented on JCR-1673:
------------------------------------
Exactly the same occurs with XPath. I have a feeling I must be stupid and that I am seriously being silly, at least I hope that is the case.
> Date comparitons are backwards in Queries
> -----------------------------------------
>
> Key: JCR-1673
> URL: https://issues.apache.org/jira/browse/JCR-1673
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: core 1.4.1
> Reporter: Michael Neale
> Priority: Critical
>
> Imagine there is a node with jcr:created of:
> 2008-07-08T15:10:07.125+10:00
> The following query:
> SELECT ... FROM .... WHERE jcr:created < '2009-07-08T15:10:07.125+10:00'
> should return it, but it doesn't. However, if you put:
> SELECT ... FROM .... WHERE jcr:created > '2009-07-08T15:10:07.125+10:00'
> then it does return it. Whoops.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-1673) Date comparitons are backwards in
Queries
Posted by "Michael Neale (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611897#action_12611897 ]
Michael Neale commented on JCR-1673:
------------------------------------
TIMESTAMP 'literal' is not valid SQL syntax for jackrabbit unfortunately - any suggestions? The spec for JCR doesn't mention what to use in SQL, only in XPath.
> Date comparitons are backwards in Queries
> -----------------------------------------
>
> Key: JCR-1673
> URL: https://issues.apache.org/jira/browse/JCR-1673
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: core 1.4.1, core 1.4.4
> Reporter: Michael Neale
> Assignee: Jukka Zitting
> Priority: Critical
>
> Imagine there is a node with jcr:created of:
> 2008-07-08T15:10:07.125+10:00
> The following query:
> SELECT ... FROM .... WHERE jcr:created < '2009-07-08T15:10:07.125+10:00'
> should return it, but it doesn't. However, if you put:
> SELECT ... FROM .... WHERE jcr:created > '2009-07-08T15:10:07.125+10:00'
> then it does return it. Whoops.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-1673) Date comparitons are backwards in
Queries
Posted by "Michael Neale (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Neale updated JCR-1673:
-------------------------------
Comment: was deleted
> Date comparitons are backwards in Queries
> -----------------------------------------
>
> Key: JCR-1673
> URL: https://issues.apache.org/jira/browse/JCR-1673
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: core 1.4.1, core 1.4.4
> Reporter: Michael Neale
> Assignee: Jukka Zitting
> Priority: Critical
>
> Imagine there is a node with jcr:created of:
> 2008-07-08T15:10:07.125+10:00
> The following query:
> SELECT ... FROM .... WHERE jcr:created < '2009-07-08T15:10:07.125+10:00'
> should return it, but it doesn't. However, if you put:
> SELECT ... FROM .... WHERE jcr:created > '2009-07-08T15:10:07.125+10:00'
> then it does return it. Whoops.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (JCR-1673) Date comparitons are backwards in Queries
Posted by "Michael Neale (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Neale closed JCR-1673.
------------------------------
Thanks for all the help people.
> Date comparitons are backwards in Queries
> -----------------------------------------
>
> Key: JCR-1673
> URL: https://issues.apache.org/jira/browse/JCR-1673
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: core 1.4.1, core 1.4.4
> Reporter: Michael Neale
> Assignee: Jukka Zitting
> Priority: Critical
>
> Imagine there is a node with jcr:created of:
> 2008-07-08T15:10:07.125+10:00
> The following query:
> SELECT ... FROM .... WHERE jcr:created < '2009-07-08T15:10:07.125+10:00'
> should return it, but it doesn't. However, if you put:
> SELECT ... FROM .... WHERE jcr:created > '2009-07-08T15:10:07.125+10:00'
> then it does return it. Whoops.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (JCR-1673) Date comparitons are backwards in
Queries
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting resolved JCR-1673.
--------------------------------
Resolution: Invalid
Assignee: Jukka Zitting
You need to mark the literal value as a date, otherwise the query will default to string comparison (the query engine doesn't know that the property in question is a date).
Use TIMESTAMP "<literal>" in an SQL query and xs:dateTime('<literal>') in an XPath query to force date comparisons.
> Date comparitons are backwards in Queries
> -----------------------------------------
>
> Key: JCR-1673
> URL: https://issues.apache.org/jira/browse/JCR-1673
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: core 1.4.1, core 1.4.4
> Reporter: Michael Neale
> Assignee: Jukka Zitting
> Priority: Critical
>
> Imagine there is a node with jcr:created of:
> 2008-07-08T15:10:07.125+10:00
> The following query:
> SELECT ... FROM .... WHERE jcr:created < '2009-07-08T15:10:07.125+10:00'
> should return it, but it doesn't. However, if you put:
> SELECT ... FROM .... WHERE jcr:created > '2009-07-08T15:10:07.125+10:00'
> then it does return it. Whoops.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-1673) Date comparitons are backwards in
Queries
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611941#action_12611941 ]
Marcel Reutegger commented on JCR-1673:
---------------------------------------
Jackrabbit translates a JCR date into a string representation that has a lexicographical order equivalent to the JCR date order. When you use a string literal in your query then Jackrabbit will match that literal with the string representation of the date, which gives you a somewhat surprising result.
> Date comparitons are backwards in Queries
> -----------------------------------------
>
> Key: JCR-1673
> URL: https://issues.apache.org/jira/browse/JCR-1673
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: core 1.4.1, core 1.4.4
> Reporter: Michael Neale
> Assignee: Jukka Zitting
> Priority: Critical
>
> Imagine there is a node with jcr:created of:
> 2008-07-08T15:10:07.125+10:00
> The following query:
> SELECT ... FROM .... WHERE jcr:created < '2009-07-08T15:10:07.125+10:00'
> should return it, but it doesn't. However, if you put:
> SELECT ... FROM .... WHERE jcr:created > '2009-07-08T15:10:07.125+10:00'
> then it does return it. Whoops.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-1673) Date comparitons are backwards in
Queries
Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611675#action_12611675 ]
Thomas Mueller commented on JCR-1673:
-------------------------------------
> You need to mark the literal value as a date, otherwise the query will default to string comparison
This sounds logical, but... how does the string representation of a date look like? I would have guessed that the string representation of xs:dateTime('2008-07-08T15:10:07.125+10:00') is '2008-07-08T15:10:07.125+10:00'? But if that would be the case, then '2008-07-08T15:10:07.125+10:00' > '2008-07-09T14:55:29.774+10:00' should not return true...
Of course you should use the correct data types (because of timezone problems and so on), but I don't understand the example above.
> Date comparitons are backwards in Queries
> -----------------------------------------
>
> Key: JCR-1673
> URL: https://issues.apache.org/jira/browse/JCR-1673
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: core 1.4.1, core 1.4.4
> Reporter: Michael Neale
> Assignee: Jukka Zitting
> Priority: Critical
>
> Imagine there is a node with jcr:created of:
> 2008-07-08T15:10:07.125+10:00
> The following query:
> SELECT ... FROM .... WHERE jcr:created < '2009-07-08T15:10:07.125+10:00'
> should return it, but it doesn't. However, if you put:
> SELECT ... FROM .... WHERE jcr:created > '2009-07-08T15:10:07.125+10:00'
> then it does return it. Whoops.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-1673) Date comparitons are backwards in
Queries
Posted by "Michael Neale (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Neale updated JCR-1673:
-------------------------------
Description:
Imagine there is a node with jcr:created of:
2008-07-08T15:10:07.125+10:00
The following query:
SELECT ... FROM .... WHERE jcr:created < '2009-07-08T15:10:07.125+10:00'
should return it, but it doesn't. However, if you put:
SELECT ... FROM .... WHERE jcr:created > '2009-07-08T15:10:07.125+10:00'
then it does return it. Whoops.
was:
Imagine there is a node with jcr:created of:
2008-07-08T15:10:07.125+10:00
The following query:
SELECT ... FROM .... WHERE jcr:created < '2008-07-09T14:55:29.774+10:00'
should return it, but it doesn't. However, if you put:
SELECT ... FROM .... WHERE jcr:created > '2008-07-09T14:55:29.774+10:00'
then it does return it. Whoops.
Summary: Date comparitons are backwards in Queries (was: Date comparitons are backwards in SQL query)
> Date comparitons are backwards in Queries
> -----------------------------------------
>
> Key: JCR-1673
> URL: https://issues.apache.org/jira/browse/JCR-1673
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: core 1.4.1
> Reporter: Michael Neale
> Priority: Critical
>
> Imagine there is a node with jcr:created of:
> 2008-07-08T15:10:07.125+10:00
> The following query:
> SELECT ... FROM .... WHERE jcr:created < '2009-07-08T15:10:07.125+10:00'
> should return it, but it doesn't. However, if you put:
> SELECT ... FROM .... WHERE jcr:created > '2009-07-08T15:10:07.125+10:00'
> then it does return it. Whoops.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.