Skip to content

Commit

Permalink
Merge pull request #4214 from soerenwolfers/patch-60
Browse files Browse the repository at this point in the history
Update utility.md
  • Loading branch information
szarnyasg authored Nov 30, 2024
2 parents 04841bc + dfef215 commit 86153c0
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions docs/sql/functions/utility.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The functions below are difficult to categorize into specific function types and
| [`checkpoint(database)`](#checkpointdatabase) | Synchronize WAL with file for (optional) database without interrupting transactions. |
| [`coalesce(expr, ...)`](#coalesceexpr-) | Return the first expression that evaluates to a non-`NULL` value. Accepts 1 or more parameters. Each expression can be a column, literal value, function result, or many others. |
| [`constant_or_null(arg1, arg2)`](#constant_or_nullarg1-arg2) | If `arg2` is `NULL`, return `NULL`. Otherwise, return `arg1`. |
| [`count_if(x)`](#count_ifx) | Returns 1 if `x` is `true` or a non-zero number. |
| [`count_if(x)`](#count_ifx) | Aggregate function; rows contribute 1 if `x` is `true` or a non-zero number, else 0. |
| [`current_catalog()`](#current_catalog) | Return the name of the currently active catalog. Default is memory. |
| [`current_schema()`](#current_schema) | Return the name of the currently active schema. Default is main. |
| [`current_schemas(boolean)`](#current_schemasboolean) | Return list of schemas. Pass a parameter of `true` to include implicit schemas. |
Expand All @@ -40,7 +40,7 @@ The functions below are difficult to categorize into specific function types and
| [`pg_typeof(expression)`](#pg_typeofexpression) | Returns the lower case name of the data type of the result of the expression. For PostgreSQL compatibility. |
| [`query(`*`query_string_literal`*`)`](#queryquery_string_literal) | Table function that parses and executes the query defined in *`query_string_literal`*. Only literal strings are allowed. Warning: this function allows invoking arbitrary queries, potentially altering the database state. |
| [`query_table(`*`tbl_name`*`)`](#query_tabletbl_name) | Table function that returns the table given in *`tbl_name`*. |
| [`query_table(`*`tbl_names`*`, [`*`by_name`*`])`](#query_tabletbl_names-by_name) | Table function that returns the union of tables given in *`tbl_names`*. If the optional *`by_name`* parameter is set to `true`, it uses [`UNION ALL BY NAME`](../../sql/query_syntax/setops#union-all-by-name) semantics. |
| [`query_table(`*`tbl_names`*`, [`*`by_name`*`])`](#query_tabletbl_names-by_name) | Table function that returns the union of tables given in *`tbl_names`*. If the optional *`by_name`* parameter is set to `true`, it uses [`UNION ALL BY NAME`]({% link docs/sql/query_syntax/setops.md %}#union-all-by-name) semantics. |
| [`read_blob(source)`](#read_blobsource) | Returns the content from `source` (a filename, a list of filenames, or a glob pattern) as a `BLOB`. See the [`read_blob` guide]({% link docs/guides/file_formats/read_file.md %}#read_blob) for more details. |
| [`read_text(source)`](#read_textsource) | Returns the content from `source` (a filename, a list of filenames, or a glob pattern) as a `VARCHAR`. The file content is first validated to be valid UTF-8. If `read_text` attempts to read a file with invalid UTF-8 an error is thrown suggesting to use `read_blob` instead. See the [`read_text` guide]({% link docs/guides/file_formats/read_file.md %}#read_text) for more details. |
| [`sha256(value)`](#sha256value) | Returns a `VARCHAR` with the SHA-256 hash of the `value`. |
Expand Down Expand Up @@ -86,7 +86,7 @@ The functions below are difficult to categorize into specific function types and

<div class="nostroke_table"></div>

| **Description** | Returns 1 if `x` is `true` or a non-zero number. |
| **Description** | Aggregate function; rows contribute 1 if `x` is `true` or a non-zero number, else 0. |
| **Example** | `count_if(42)` |
| **Result** | 1 |

Expand Down Expand Up @@ -211,15 +211,15 @@ The functions below are difficult to categorize into specific function types and

<div class="nostroke_table"></div>

| **Description** | Returns the MD5 hash of the `string` as a `BIGINT`. |
| **Description** | Returns the lower 8 bytes of the MD5 hash of `string` as a `BIGINT`. |
| **Example** | `md5_number_lower('123')` |
| **Result** | `8091599832034528150` |

#### `md5_number_higher(string)`

<div class="nostroke_table"></div>

| **Description** | Returns the MD5 hash of the `string` as a `BIGINT`. |
| **Description** | Returns the higher 8 bytes of the MD5 hash of `string` as a `BIGINT`. |
| **Example** | `md5_number_higher('123')` |
| **Result** | `6559309979213966368` |

Expand Down Expand Up @@ -247,27 +247,27 @@ The functions below are difficult to categorize into specific function types and
| **Example** | `pg_typeof('abc')` |
| **Result** | `varchar` |

#### `query(`*`query_string_literal`*`)`
#### `query(query_string_literal)`

<div class="nostroke_table"></div>

| **Description** | Table function that parses and executes the query defined in *`query_string_literal`*. Only literal strings are allowed. Warning: this function allows invoking arbitrary queries, potentially altering the database state. |
| **Description** | Table function that parses and executes the query defined in `query_string_literal`. Only literal strings are allowed. Warning: this function allows invoking arbitrary queries, potentially altering the database state. |
| **Example** | `query('SELECT 42 AS x')` |
| **Result** | `42` |

#### `query_table(`*`tbl_name`*`)`
#### `query_table(tbl_name)`

<div class="nostroke_table"></div>

| **Description** | Table function that returns the table given in *`tbl_name`*. |
| **Example** | `query(t1)` |
| **Description** | Table function that returns the table given in `tbl_name`. |
| **Example** | `query('t1')` |
| **Result** | (the rows of `t1`) |

#### `query_table(`*`tbl_names`*`, [`*`by_name`*`])`
#### `query_table(tbl_names, [by_name])`

<div class="nostroke_table"></div>

| **Description** | Table function that returns the union of tables given in *`tbl_names`*. If the optional *`by_name`* parameter is set to `true`, it uses [`UNION ALL BY NAME`](../../sql/query_syntax/setops#union-all-by-name) semantics. |
| **Description** | Table function that returns the union of tables given in `tbl_names`. If the optional `by_name` parameter is set to `true`, it uses [`UNION ALL BY NAME`]({% link docs/sql/query_syntax/setops.md %}#union-all-by-name) semantics. |
| **Example** | `query(['t1', 't2'])` |
| **Result** | (the union of the two tables) |

Expand Down

0 comments on commit 86153c0

Please sign in to comment.