Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document substr(bytea) #1440

Merged
merged 5 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/sql/functions-operators/sql-function-binarystring.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,27 @@ SELECT sha512('risingwave'::bytea);
\x3d6d6078c75ad459cdc689216d5de35bd6d9a9a50b9bed96417aaf7ad25057b37460564f0ad23a589c655eda45026096a6bab08b3c863f0425cbfea64b5f84a8
```

---

### `substr`

Extracts a substring from a binary string (bytea) starting at position `start_int` for `count_int` bytes. If `count_int` is omitted, the substring extends to the end of the bytea value.

```sql title=Syntax
substr ( bytea_value, start_int, [, count_int] ) -> bytea
```

```sql title=Example
SELECT substr('abcde'::bytea, 2, 7);
```
```
\x62636465
```

```sql title=Example
SELECT substr('abcde'::bytea, -2, 5);
```
```
\x6162
```
---
1 change: 0 additions & 1 deletion docs/sql/functions-operators/sql-function-conditional.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,3 @@ Returns null if *value1* equals to *value2*, otherwise returns *value1*.
```sql
NULLIF ( value1, value2 )
```

2 changes: 1 addition & 1 deletion docs/sql/functions-operators/sql-function-string.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ starts_with('RisingWave is powerful', 'Rising') → true

### `substr`/`substring`

Extracts the substring from input_string starting at position start_int and extending for count_int characters, if specified. start_int should be equal to or larger than 1.
Extracts the substring from input_string starting at position start_int and extending for count_int characters.

```bash title=Syntax
substr( input_string, start_int[, count_int] ) → output_string
Expand Down
Loading