Skip to content

Commit

Permalink
Merge branch 'main' into v25.1.0-rc.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeCRL authored Feb 10, 2025
2 parents 278bf16 + 11b81af commit 1e02e02
Show file tree
Hide file tree
Showing 9 changed files with 228 additions and 154 deletions.
7 changes: 0 additions & 7 deletions src/current/_data/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8125,13 +8125,6 @@
docker_arm_limited_access: false
source: true
previous_release: v23.2.19
cloud_only: true
cloud_only_message_short: 'Available only for select CockroachDB Cloud clusters'
cloud_only_message: >
This version is currently available only for select
CockroachDB Cloud clusters. To request to upgrade
a CockroachDB self-hosted cluster to this version,
[contact support](https://support.cockroachlabs.com/hc/requests/new).

- release_name: v24.3.5
major_version: v24.3
Expand Down
9 changes: 7 additions & 2 deletions src/current/_includes/molt/molt-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
| Linux | [Download](https://molt.cockroachdb.com/molt/cli/molt-latest.linux-amd64.tgz) | [Download](https://molt.cockroachdb.com/molt/cli/molt-latest.linux-arm64.tgz) |
| Mac | [Download](https://molt.cockroachdb.com/molt/cli/molt-latest.darwin-amd64.tgz) | [Download](https://molt.cockroachdb.com/molt/cli/molt-latest.darwin-arm64.tgz) |

For previous binaries, refer to the [MOLT version manifest](https://molt.cockroachdb.com/molt/cli/versions.html). {% if page.name != "molt.md" %}For release details, see the [MOLT changelog]({% link releases/molt.md %}).{% endif %}
The following binaries are included:

- `molt`
- `replicator`. To use replication features, `replicator` **must** be located either in the same directory as `molt` or in a directory beneath `molt`.

For previous binaries, refer to the [MOLT version manifest](https://molt.cockroachdb.com/molt/cli/versions.html). {% if page.name != "molt.md" %}For release details, refer to the [MOLT changelog]({% link releases/molt.md %}).{% endif %}

{% if page.name == "molt-fetch.md" or page.name == "molt.md" %}
{{site.data.alerts.callout_info}}
Expand All @@ -28,4 +33,4 @@ To pull a specific version (e.g., `1.1.3`):
docker pull cockroachdb/molt:1.1.3
~~~

{% if page.name != "molt.md" %}For details on running in Docker, see [Docker usage](#docker-usage).{% endif %}
{% if page.name != "molt.md" %}For details on running in Docker, see [Docker usage](#docker-usage).{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
- Expressions (column, index, constraint) in tables. [#87699](https://github.com/cockroachdb/cockroach/issues/87699)
- Views. [#87699](https://github.com/cockroachdb/cockroach/issues/87699)
- User-defined functions cannot call themselves recursively. [#93049](https://github.com/cockroachdb/cockroach/issues/93049)
- [Common table expressions]({% link {{ page.version.version }}/common-table-expressions.md %}) (CTE), recursive or non-recursive, are not supported in [user-defined functions]({% link {{ page.version.version }}/user-defined-functions.md %}) (UDF). That is, you cannot use a `WITH` clause in the body of a UDF. [#92961](https://github.com/cockroachdb/cockroach/issues/92961)
- The `setval` function cannot be resolved when used inside UDF bodies. [#110860](https://github.com/cockroachdb/cockroach/issues/110860)
- Casting subqueries to [user-defined types]({% link {{ page.version.version }}/create-type.md %}) in UDFs is not supported. [#108184](https://github.com/cockroachdb/cockroach/issues/108184)
42 changes: 22 additions & 20 deletions src/current/molt/molt-fetch.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/current/molt/molt-verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ Flag | Description
`--log-file` | Write messages to the specified log filename. If no filename is provided, messages write to `verify-{datetime}.log`. If `"stdout"` is provided, messages write to `stdout`.
`--metrics-listen-addr` | Address of the metrics endpoint, which has the path `{address}/metrics`.<br><br>**Default:** `'127.0.0.1:3030'` |
`--row-batch-size` | Number of rows to get from a table at a time. <br>**Default:** 20000
`--schema-filter` | Verify schemas that match a specified [regular expression](https://wikipedia.org/wiki/Regular_expression).
`--table-filter` | Verify tables that match a specified [regular expression](https://wikipedia.org/wiki/Regular_expression).
`--schema-filter` | Verify schemas that match a specified [regular expression](https://wikipedia.org/wiki/Regular_expression).<br><br>**Default:** `'.*'`
`--table-filter` | Verify tables that match a specified [regular expression](https://wikipedia.org/wiki/Regular_expression).<br><br>**Default:** `'.*'`

## Usage

Expand Down
9 changes: 9 additions & 0 deletions src/current/releases/molt.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ To download the latest MOLT Fetch/Verify binary:

{% include molt/molt-install.md %}

## February 5, 2025

MOLT Fetch/Verify 1.2.2 is [available](#installation).

- Added an [`--import-region`]({% link molt/molt-fetch.md %}#global-flags) flag that is used to set the `AWS_REGION` query parameter explicitly in the [`s3` URL]({% link molt/molt-fetch.md %}#cloud-storage).
- Fixed the [`truncate-if-exists`]({% link molt/molt-fetch.md %}#target-table-handling) schema mode for cases where there are uppercase table or schema names.
- Fixed an issue with unsigned `BIGINT` values overflowing in replication.
- Added a `--schemaRefresh` [replication flag]({% link molt/molt-fetch.md %}#replication-flags) that is used to configure the schema watcher refresh delay in the replication phase. Previously, the refresh delay was set to a constant value of 1 minute. Set the flag as follows: `--replicator-flags "--schemaRefresh {value}"`.

## December 13, 2024

MOLT Fetch/Verify 1.2.1 is [available](#installation).
Expand Down
125 changes: 68 additions & 57 deletions src/current/v24.3/create-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,77 +294,88 @@ The preceding example modifies a given `name` value and returns the `NEW` [trigg

The following example defines a function using the `SECURITY DEFINER` clause. This causes the function to execute with the privileges of the function owner.

Create two roles:
1. Create two roles:

{% include_cached copy-clipboard.html %}
~~~ sql
CREATE ROLE owner;
CREATE ROLE invoker;
~~~
{% include_cached copy-clipboard.html %}
~~~ sql
CREATE ROLE owner;
CREATE ROLE invoker;
~~~

Grant a [`SELECT` privilege]({% link {{ page.version.version }}/grant.md %}#supported-privileges) on the `user_promo_codes` table to the `owner` role.
1. Grant a [`SELECT` privilege]({% link {{ page.version.version }}/grant.md %}#supported-privileges) on the `user_promo_codes` table to the `owner` role.

{% include_cached copy-clipboard.html %}
~~~ sql
GRANT SELECT ON TABLE user_promo_codes TO owner;
~~~
{% include_cached copy-clipboard.html %}
~~~ sql
GRANT SELECT ON TABLE user_promo_codes TO owner;
~~~

Set your role to `owner`.
1. Set your role to `owner`.

{% include_cached copy-clipboard.html %}
~~~ sql
SET ROLE owner;
~~~

Create a simple `SECURITY DEFINER` function that reads the contents of `user_promo_codes`.
{% include_cached copy-clipboard.html %}
~~~ sql
SET ROLE owner;
~~~

{% include_cached copy-clipboard.html %}
~~~ sql
CREATE OR REPLACE FUNCTION get_codes()
RETURNS SETOF RECORD
LANGUAGE SQL
SECURITY DEFINER
AS $$
SELECT * FROM user_promo_codes;
$$;
~~~
1. Create a simple `SECURITY DEFINER` function that reads the contents of `user_promo_codes`.

Set your role to `invoker`.
{% include_cached copy-clipboard.html %}
~~~ sql
CREATE OR REPLACE FUNCTION get_codes()
RETURNS SETOF RECORD
LANGUAGE SQL
SECURITY DEFINER
AS $$
SELECT * FROM user_promo_codes;
$$;
~~~

{% include_cached copy-clipboard.html %}
~~~ sql
SET ROLE invoker;
~~~
1. Grant the [`EXECUTE` privilege]({% link {{ page.version.version }}/grant.md %}#supported-privileges) on the `get_codes` function to the `invoker` role.

`invoker` does not have the privileges to read the `user_promo_codes` table directly:
{% include_cached copy-clipboard.html %}
~~~ sql
GRANT EXECUTE ON FUNCTION get_codes() TO invoker;
~~~

{% include_cached copy-clipboard.html %}
~~~ sql
SELECT * FROM user_promo_codes;
~~~
{{site.data.alerts.callout_info}}
This step is not necessary if the function is defined on the `public` schema, for which roles automatically have the `EXECUTE` privilege.
{{site.data.alerts.end}}

~~~
ERROR: user invoker does not have SELECT privilege on relation user_promo_codes
SQLSTATE: 42501
~~~
1. Set your role to `invoker`.

As `invoker`, you can call the `get_codes` function, since `SECURITY DEFINER` is executed with the privileges of the `owner` role:
{% include_cached copy-clipboard.html %}
~~~ sql
SET ROLE invoker;
~~~

{% include_cached copy-clipboard.html %}
~~~ sql
SELECT get_codes();
~~~
1. `invoker` does not have the privileges to read the `user_promo_codes` table directly:

~~~
get_codes
------------------------------------------------------------------------------------------------------------
("new york",00000000-0000-4000-8000-000000000000,0_audience_thought_seven,"2019-01-02 03:04:05",10)
("new york",051eb851-eb85-4ec0-8000-000000000001,1_assume_its_leg,"2019-01-02 03:04:05.001",0)
("new york",0a3d70a3-d70a-4d80-8000-000000000002,2_popular_if_describe,"2019-01-02 03:04:05.002",16)
("new york",0f5c28f5-c28f-4c00-8000-000000000003,3_environmental_myself_add,"2019-01-02 03:04:05.003",4)
("new york",147ae147-ae14-4b00-8000-000000000004,4_rule_edge_career,"2019-01-02 03:04:05.004",13)
(5 rows)
~~~
{% include_cached copy-clipboard.html %}
~~~ sql
SELECT * FROM user_promo_codes;
~~~

~~~
ERROR: user invoker does not have SELECT privilege on relation user_promo_codes
SQLSTATE: 42501
~~~

1. As `invoker`, call the `get_codes` function to read `user_promo_codes`, since `SECURITY DEFINER` is executed with the privileges of the `owner` role (i.e., `SELECT` on `user_promo_codes`).

{% include_cached copy-clipboard.html %}
~~~ sql
SELECT get_codes();
~~~

~~~
get_codes
------------------------------------------------------------------------------------------------------------
("new york",00000000-0000-4000-8000-000000000000,0_audience_thought_seven,"2019-01-02 03:04:05",10)
("new york",051eb851-eb85-4ec0-8000-000000000001,1_assume_its_leg,"2019-01-02 03:04:05.001",0)
("new york",0a3d70a3-d70a-4d80-8000-000000000002,2_popular_if_describe,"2019-01-02 03:04:05.002",16)
("new york",0f5c28f5-c28f-4c00-8000-000000000003,3_environmental_myself_add,"2019-01-02 03:04:05.003",4)
("new york",147ae147-ae14-4b00-8000-000000000004,4_rule_edge_career,"2019-01-02 03:04:05.004",13)
(5 rows)
~~~

## See also

Expand Down
Loading

0 comments on commit 1e02e02

Please sign in to comment.