From a35df37e8fb3ab9d8ad2a0a5a604383a34623b8e Mon Sep 17 00:00:00 2001 From: Demian Hespe Date: Thu, 30 Nov 2023 16:46:27 +0100 Subject: [PATCH] split_part with empty delimiter behaves like postgres in FB 2.0 --- .../functions-reference/string/split-part.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/sql_reference/functions-reference/string/split-part.md b/docs/sql_reference/functions-reference/string/split-part.md index 21d81d1e..99571bb5 100644 --- a/docs/sql_reference/functions-reference/string/split-part.md +++ b/docs/sql_reference/functions-reference/string/split-part.md @@ -9,7 +9,7 @@ great_grand_parent: SQL reference # SPLIT_PART -Divides a string based on a specified delimiter into an array of substrings. The string in the specified index is returned, with `1` being the first index. If the string separator is empty, the string is divided into an array of single characters. +Divides a string based on a specified delimiter into an array of substrings. The string in the specified index is returned, with `1` being the first index. If the string separator is empty, the string is returned at index `1`. ## Syntax {: .no_toc} @@ -27,7 +27,7 @@ Please note that the order of the arguments is different than the [`SPLIT` funct | Parameter | Description | Supported input types | | :---------------| :--------------------------------|:---------------------------- | | `` | An expression evaluating to a string to be split. | `TEXT` | -| `` | Any character or substring within ``. If `` is an empty string `''`, the `` will be divided into single characters. | `TEXT` | +| `` | Any character or substring within ``. If `` is an empty string `''`, the `` will be returned at index `1`. | `TEXT` | | `` | The index from which to return the substring. | `INTEGER` | ## Return Type @@ -50,9 +50,16 @@ SELECT **Returns**: `test` +```sql +SELECT + SPLIT_PART('hello world', '', 1 ) AS res; +``` + +**Returns**: `hello world` + ```sql SELECT SPLIT_PART('hello world', '', 7 ) AS res; ``` -**Returns**: `w` +**Returns**: ``