Skip to content

Commit d48d8a9

Browse files
vitstnrekby
authored andcommitted
sql lang functions [docs] (ydb-platform#8378)
1 parent 44fa86e commit d48d8a9

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

ydb/docs/en/core/postgresql/_includes/functions.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,9 @@ Checks whether the string is in the specified Unicode normalization form. The op
461461
```sql
462462
U&'\0061\0308bc' IS NFD NORMALIZED → true
463463
```||
464-
||bit_length ( text ) → integer|Returns number of bits in the string (8 times the octet_length) (UNSUPPORTED)|
464+
||bit_length ( text ) → integer|Returns number of bits in the string (8 times the octet_length)|
465465
```sql
466-
#bit_length('jose') → 32
466+
bit_length('jose') → 32
467467
```||
468468
||char_length ( text ) → integer
469469
character_length ( text ) → integer|
@@ -514,9 +514,9 @@ substring('Thomas' from '...$') → mas
514514
```||
515515
||substring ( string text SIMILAR pattern text ESCAPE escape text ) → text
516516
substring ( string text FROM pattern text FOR escape text ) → text|
517-
Extracts the first substring matching SQL regular expression; see Section 9.7.2. The first form has been specified since SQL:2003; the second form was only in SQL:1999 and should be considered obsolete. (NOT SUPPORTED)|
517+
Extracts the first substring matching SQL regular expression; see Section 9.7.2. The first form has been specified since SQL:2003; the second form was only in SQL:1999 and should be considered obsolete.|
518518
```sql
519-
#substring('Thomas' similar '%#"o_a#"_' escape '#') → oma
519+
substring('Thomas' similar '%#"o_a#"_' escape '#') → oma
520520
```||
521521
||trim ( [ LEADING \| TRAILING \| BOTH ] [ characters text ] FROM string text ) → text|
522522
Removes the longest string containing only characters in characters (a space by default) from the start, end, or both ends (BOTH is the default) of string.|
@@ -602,9 +602,9 @@ Computes the MD5 hash of the argument, with the result written in hexadecimal.|
602602
md5('abc') → 900150983cd24fb0d6963f7d28e17f72
603603
```||
604604
||parse_ident ( qualified_identifier text [, strict_mode boolean DEFAULT true ] ) → text[]|
605-
Splits qualified_identifier into an array of identifiers, removing any quoting of individual identifiers. By default, extra characters after the last identifier are considered an error; but if the second parameter is false, then such extra characters are ignored. (This behavior is useful for parsing names for objects like functions.) Note that this function does not truncate over-length identifiers. If you want truncation you can cast the result to name[]. (NOT SUPPORTED)|
605+
Splits qualified_identifier into an array of identifiers, removing any quoting of individual identifiers. By default, extra characters after the last identifier are considered an error; but if the second parameter is false, then such extra characters are ignored. (This behavior is useful for parsing names for objects like functions.) Note that this function does not truncate over-length identifiers. If you want truncation you can cast the result to name[].|
606606
```sql
607-
#parse_ident('"SomeSchema".someTable') → {SomeSchema,sometable}
607+
parse_ident('"SomeSchema".someTable') → {SomeSchema,someTable}
608608
```||
609609
||pg_client_encoding ( ) → name|
610610
Returns current client encoding name.|
@@ -768,9 +768,9 @@ Concatenates the two binary strings.|
768768
'\x123456'::bytea || '\x789a00bcde'::bytea → \x123456789a00bcde
769769
```||
770770
||bit_length ( bytea ) → integer|
771-
Returns number of bits in the binary string (8 times the octet_length). (NOT SUPPORTED)|
771+
Returns number of bits in the binary string (8 times the octet_length).|
772772
```sql
773-
#bit_length('\x123456'::bytea) → 24
773+
bit_length('\x123456'::bytea) → 24
774774
```||
775775
||octet_length ( bytea ) → integer|
776776
Returns number of bytes in the binary string.|
@@ -985,9 +985,9 @@ Returns the number of bits set in the bit string (also known as “popcount”).
985985
bit_count(B'10111') → 4
986986
```||
987987
||bit_length ( bit ) → integer|
988-
Returns number of bits in the bit string. (NOT SUPPORTED)|
988+
Returns number of bits in the bit string.|
989989
```sql
990-
#bit_length(B'10111') → 5
990+
bit_length(B'10111') → 5
991991
```||
992992
||length ( bit ) → integer|
993993
Returns number of bits in the bit string.|
@@ -1145,13 +1145,13 @@ As with SIMILAR TO, the specified pattern must match the entire data string, or
11451145

11461146
The escape-double-quote separators actually divide substring's pattern into three independent regular expressions; for example, a vertical bar (|) in any of the three sections affects only that section. Also, the first and third of these regular expressions are defined to match the smallest possible amount of text, not the largest, when there is any ambiguity about how much of the data string matches which pattern. (In POSIX parlance, the first and third regular expressions are forced to be non-greedy.)
11471147

1148-
As an extension to the SQL standard, PostgreSQL allows there to be just one escape-double-quote separator, in which case the third regular expression is taken as empty; or no separators, in which case the first and third regular expressions are taken as empty. (NOT SUPPORTED)
1148+
As an extension to the SQL standard, PostgreSQL allows there to be just one escape-double-quote separator, in which case the third regular expression is taken as empty; or no separators, in which case the first and third regular expressions are taken as empty.
11491149

11501150
Some examples, with #" delimiting the return string:
11511151

11521152
```sql
1153-
#substring('foobar' similar '%#"o_b#"%' escape '#') → oob
1154-
#substring('foobar' similar '#"o_b#"%' escape '#') → NULL
1153+
substring('foobar' similar '%#"o_b#"%' escape '#') → oob
1154+
substring('foobar' similar '#"o_b#"%' escape '#') → NULL
11551155
```
11561156

11571157
9.7.3. POSIX Regular Expressions
@@ -1565,9 +1565,9 @@ Subtract arguments, producing a “symbolic” result that uses years and months
15651565
age(timestamp '2001-04-10', timestamp '1957-06-13') → 43 years 9 mons 27 days
15661566
```||
15671567
||age ( timestamp ) → interval|
1568-
Subtract argument from current_date (at midnight) (NOT SUPPORTED)|
1568+
Subtract argument from current_date (at midnight)|
15691569
```sql
1570-
#age(timestamp '1957-06-13') → 62 years 6 mons 10 days
1570+
age(timestamp '1957-06-13') ~62 years 6 mons 10 days
15711571
```||
15721572
||clock_timestamp ( ) → timestamp with time zone|
15731573
Current date and time (changes during statement execution); see Section 9.9.5|
@@ -1753,7 +1753,7 @@ This expression yields true when two time periods (defined by their endpoints) o
17531753

17541754
```sql
17551755
(DATE '2001-02-16', DATE '2001-12-21') OVERLAPS (DATE '2001-10-30', DATE '2002-10-30') → true
1756-
#(DATE '2001-02-16', INTERVAL '100 days') OVERLAPS (DATE '2001-10-30', DATE '2002-10-30') → false
1756+
(DATE '2001-02-16', INTERVAL '100 days') OVERLAPS (DATE '2001-10-30', DATE '2002-10-30') → false
17571757
(DATE '2001-10-29', DATE '2001-10-30') OVERLAPS (DATE '2001-10-30', DATE '2001-10-31') → false
17581758
(DATE '2001-10-30', DATE '2001-10-30') OVERLAPS (DATE '2001-10-30', DATE '2001-10-31') → true
17591759
```
@@ -2518,9 +2518,9 @@ Converts box to a 4-point polygon.|
25182518
polygon(box '(1,1),(0,0)') → ((0,0),(0,1),(1,1),(1,0))
25192519
```||
25202520
||polygon ( circle ) → polygon|
2521-
Converts circle to a 12-point polygon. (NOT SUPPORTED)|
2521+
Converts circle to a 12-point polygon.|
25222522
```sql
2523-
#polygon(circle '<(0,0),2>') → ((-2,0),(-1.7320508075688774,0.9999999999999999),(-1.0000000000000002,1.7320508075688772),(-1.2246063538223773e-16,2),(0.9999999999999996,1.7320508075688774),(1.732050807568877,1.0000000000000007),(2,2.4492127076447545e-16),(1.7320508075688776,-0.9999999999999994),(1.0000000000000009,-1.7320508075688767),(3.673819061467132e-16,-2),(-0.9999999999999987,-1.732050807568878),(-1.7320508075688767,-1.0000000000000009))
2523+
polygon(circle '<(0,0),2>') → ((-2,0),(-1.7320508075688774,0.9999999999999999),(-1.0000000000000002,1.7320508075688772),(-1.2246467991473532e-16,2),(0.9999999999999996,1.7320508075688774),(1.732050807568877,1.0000000000000007),(2,2.4492935982947064e-16),(1.7320508075688776,-0.9999999999999994),(1.0000000000000009,-1.7320508075688767),(3.6739403974420594e-16,-2),(-0.9999999999999987,-1.732050807568878),(-1.7320508075688767,-1.0000000000000009))
25242524
```||
25252525
||polygon ( path ) → polygon|
25262526
Converts closed path to a polygon with the same list of points.|
@@ -3196,18 +3196,18 @@ Expands the top-level JSON array of objects to a set of rows having the composit
31963196
Returns target with the item designated by path replaced by new_value, or with new_value added if create_if_missing is true (which is the default) and the item designated by path does not exist. All earlier steps in the path must exist, or the target is returned unchanged. As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays. If the last path step is an array index that is out of range, and create_if_missing is true, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.|
31973197
```sql
31983198
jsonb_set('[{"f1":1,"f2":null},2,null,3]', '{0,f1}', '[2,3,4]', false) → [{"f1": [2, 3, 4], "f2": null}, 2, null, 3]
3199-
#jsonb_set('[{"f1":1,"f2":null},2]', '{0,f3}', '[2,3,4]') → [{"f1": 1, "f2": null, "f3": [2, 3, 4]}, 2]
3199+
jsonb_set('[{"f1":1,"f2":null},2]', '{0,f3}', '[2,3,4]') → [{"f1": 1, "f2": null, "f3": [2, 3, 4]}, 2]
32003200
```||
32013201
||jsonb_set_lax ( target jsonb, path text[], new_value jsonb [, create_if_missing boolean [, null_value_treatment text ]] ) → jsonb|
32023202
If new_value is not NULL, behaves identically to jsonb_set. Otherwise behaves according to the value of null_value_treatment which must be one of 'raise_exception', 'use_json_null', 'delete_key', or 'return_target'. The default is 'use_json_null'.|
32033203
```sql
3204-
#jsonb_set_lax('[{"f1":1,"f2":null},2,null,3]', '{0,f1}', null) → [{"f1": null, "f2": null}, 2, null, 3]
3204+
jsonb_set_lax('[{"f1":1,"f2":null},2,null,3]', '{0,f1}', null) → [{"f1": null, "f2": null}, 2, null, 3]
32053205
jsonb_set_lax('[{"f1":99,"f2":null},2]', '{0,f3}', null, true, 'return_target') → [{"f1": 99, "f2": null}, 2]
32063206
```||
32073207
||jsonb_insert ( target jsonb, path text[], new_value jsonb [, insert_after boolean ] ) → jsonb|
32083208
Returns target with new_value inserted. If the item designated by the path is an array element, new_value will be inserted before that item if insert_after is false (which is the default), or after it if insert_after is true. If the item designated by the path is an object field, new_value will be inserted only if the object does not already contain that key. All earlier steps in the path must exist, or the target is returned unchanged. As with the path oriented operators, negative integers that appear in the path count from the end of JSON arrays. If the last path step is an array index that is out of range, the new value is added at the beginning of the array if the index is negative, or at the end of the array if it is positive.|
32093209
```sql
3210-
#jsonb_insert('{"a": [0,1,2]}', '{a, 1}', '"new_value"') → {"a": [0, "new_value", 1, 2]}
3210+
jsonb_insert('{"a": [0,1,2]}', '{a, 1}', '"new_value"') → {"a": [0, "new_value", 1, 2]}
32113211
jsonb_insert('{"a": [0,1,2]}', '{a, 1}', '"new_value"', true) → {"a": [0, 1, "new_value", 2]}
32123212
```||
32133213
||json_strip_nulls ( json ) → json

0 commit comments

Comments
 (0)