You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2018/09/20 03:14:00 UTC

[jira] [Resolved] (CALCITE-2572) SUBSTRING function fails if start position is less than 1

     [ https://issues.apache.org/jira/browse/CALCITE-2572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Hyde resolved CALCITE-2572.
----------------------------------
       Resolution: Fixed
    Fix Version/s: 1.18.0

Fixed in [4f1b5eff|http://git-wip-us.apache.org/repos/asf/calcite/commit/4f1b5eff]; thanks for the PR, [~apilloud]!

> SUBSTRING function fails if start position is less than 1
> ---------------------------------------------------------
>
>                 Key: CALCITE-2572
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2572
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Andrew Pilloud
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.18.0
>
>
> Calcite substring throws a IndexOutOfBoundsException with a position less than 1. Per the SQL standard, the position should be treated as the larger of the provided value and 1, however many implementations treat negative values as starting from the end of the string.
> Extended standard:
> https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions162.htm
> https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_substring
> https://spark.apache.org/docs/2.3.0/api/sql/index.html#substring
> https://www.sqlite.org/lang_corefunc.html#substr
> Follow the standard:
> https://docs.microsoft.com/en-us/sql/t-sql/functions/substring-transact-sql?view=sql-server-2017
> https://www.postgresql.org/docs/9.1/static/functions-string.html



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)