Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
111965: sql,clusterversion: add a cluster version for procedures r=mgartner a=mgartner

#### sql,clusterversion: add a cluster version for procedures

Release note: None

#### sql/logictest: rename drop_routine to drop_function

The drop_routine test file has been renamed to drop_function because it
only tests dropping functions.

Release note: None

#### sql/logictest: move DROP PROCEDURE tests to their own file

This commit moves `DROP PROCEDURE` tests to their own file so that they
can be disabled for the mixed version configuration in a future commit.

Epic: CRDB-25388

Release note: None

Co-authored-by: Marcus Gartner <[email protected]>
  • Loading branch information
craig[bot] and mgartner committed Oct 7, 2023
2 parents 8303a8c + 6c60444 commit 76a8d10
Show file tree
Hide file tree
Showing 24 changed files with 417 additions and 298 deletions.
2 changes: 1 addition & 1 deletion docs/generated/settings/settings-for-tenants.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,4 @@ trace.snapshot.rate duration 0s if non-zero, interval at which background trace
trace.span_registry.enabled boolean true if set, ongoing traces can be seen at https://<ui>/#/debug/tracez application
trace.zipkin.collector string the address of a Zipkin instance to receive traces, as <host>:<port>. If no port is specified, 9411 will be used. application
ui.display_timezone enumeration etc/utc the timezone used to format timestamps in the ui [etc/utc = 0, america/new_york = 1] application
version version 1000023.1-32 set the active cluster version in the format '<major>.<minor>' application
version version 1000023.1-34 set the active cluster version in the format '<major>.<minor>' application
2 changes: 1 addition & 1 deletion docs/generated/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,6 @@
<tr><td><div id="setting-trace-span-registry-enabled" class="anchored"><code>trace.span_registry.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>if set, ongoing traces can be seen at https://&lt;ui&gt;/#/debug/tracez</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-trace-zipkin-collector" class="anchored"><code>trace.zipkin.collector</code></div></td><td>string</td><td><code></code></td><td>the address of a Zipkin instance to receive traces, as &lt;host&gt;:&lt;port&gt;. If no port is specified, 9411 will be used.</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-ui-display-timezone" class="anchored"><code>ui.display_timezone</code></div></td><td>enumeration</td><td><code>etc/utc</code></td><td>the timezone used to format timestamps in the ui [etc/utc = 0, america/new_york = 1]</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-version" class="anchored"><code>version</code></div></td><td>version</td><td><code>1000023.1-32</code></td><td>set the active cluster version in the format &#39;&lt;major&gt;.&lt;minor&gt;&#39;</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
<tr><td><div id="setting-version" class="anchored"><code>version</code></div></td><td>version</td><td><code>1000023.1-34</code></td><td>set the active cluster version in the format &#39;&lt;major&gt;.&lt;minor&gt;&#39;</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
</tbody>
</table>
19 changes: 13 additions & 6 deletions pkg/ccl/logictestccl/tests/3node-tenant/generated_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion pkg/clusterversion/cockroach_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,9 @@ const (
// {statement|transaction}_execution_insights system tables.
V23_2_AddSystemExecInsightsTable

// V23_2_Procedures is the version where procedures are enabled.
V23_2_Procedures

// *************************************************
// Step (1) Add new versions here.
// Do not add new versions to a patch release.
Expand Down Expand Up @@ -855,11 +858,14 @@ var rawVersionsSingleton = keyedVersions{
Key: V23_2_MVCCStatisticsTable,
Version: roachpb.Version{Major: 23, Minor: 1, Internal: 30},
},

{
Key: V23_2_AddSystemExecInsightsTable,
Version: roachpb.Version{Major: 23, Minor: 1, Internal: 32},
},
{
Key: V23_2_Procedures,
Version: roachpb.Version{Major: 23, Minor: 1, Internal: 34},
},

// *************************************************
// Step (2): Add new versions here.
Expand Down
149 changes: 81 additions & 68 deletions pkg/sql/logictest/testdata/logic_test/crdb_internal
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,7 @@ CREATE FUNCTION f(STRING, b INT) RETURNS STRING STRICT IMMUTABLE LEAKPROOF LANGU

# Add a procedure to ensure that it doesn't show up in the
# create_function_statements table.
skipif config local-mixed-22.2-23.1
statement ok
CREATE PROCEDURE f(BOOL) LANGUAGE SQL AS $$ SELECT 1 $$;

Expand All @@ -1467,93 +1468,96 @@ CREATE SCHEMA sc;
statement
CREATE FUNCTION sc.f2(STRING) RETURNS STRING LANGUAGE SQL AS $$ SELECT 'hello' $$;

query ITITITT
SELECT database_id, database_name, schema_id, schema_name, function_id, function_name, create_statement
query TTTT
SELECT database_name, schema_name, function_name, create_statement
FROM crdb_internal.create_function_statements
WHERE function_name IN ('f', 'f2')
ORDER BY function_id;
----
104 test 105 public 129 f CREATE FUNCTION public.f(IN INT8)
RETURNS INT8
VOLATILE
NOT LEAKPROOF
CALLED ON NULL INPUT
LANGUAGE SQL
AS $$
SELECT 1;
$$
104 test 105 public 130 f CREATE FUNCTION public.f(IN STRING, IN b INT8)
RETURNS STRING
IMMUTABLE
LEAKPROOF
STRICT
LANGUAGE SQL
AS $$
SELECT 'hello';
$$
104 test 132 sc 133 f2 CREATE FUNCTION sc.f2(IN STRING)
RETURNS STRING
VOLATILE
NOT LEAKPROOF
CALLED ON NULL INPUT
LANGUAGE SQL
AS $$
SELECT 'hello';
$$
test public f CREATE FUNCTION public.f(IN INT8)
RETURNS INT8
VOLATILE
NOT LEAKPROOF
CALLED ON NULL INPUT
LANGUAGE SQL
AS $$
SELECT 1;
$$
test public f CREATE FUNCTION public.f(IN STRING, IN b INT8)
RETURNS STRING
IMMUTABLE
LEAKPROOF
STRICT
LANGUAGE SQL
AS $$
SELECT 'hello';
$$
test sc f2 CREATE FUNCTION sc.f2(IN STRING)
RETURNS STRING
VOLATILE
NOT LEAKPROOF
CALLED ON NULL INPUT
LANGUAGE SQL
AS $$
SELECT 'hello';
$$

statement ok
CREATE DATABASE test_cross_db;
USE test_cross_db;
CREATE FUNCTION f_cross_db() RETURNS INT LANGUAGE SQL AS $$ SELECT 1 $$;
USE test;

query ITITITT
SELECT database_id, database_name, schema_id, schema_name, function_id, function_name, create_statement
query TTTT
SELECT database_name, schema_name, function_name, create_statement
FROM "".crdb_internal.create_function_statements
WHERE function_name IN ('f', 'f2', 'f_cross_db')
ORDER BY function_id;
----
104 test 105 public 129 f CREATE FUNCTION public.f(IN INT8)
RETURNS INT8
VOLATILE
NOT LEAKPROOF
CALLED ON NULL INPUT
LANGUAGE SQL
AS $$
SELECT 1;
$$
104 test 105 public 130 f CREATE FUNCTION public.f(IN STRING, IN b INT8)
RETURNS STRING
IMMUTABLE
LEAKPROOF
STRICT
LANGUAGE SQL
AS $$
SELECT 'hello';
$$
104 test 132 sc 133 f2 CREATE FUNCTION sc.f2(IN STRING)
RETURNS STRING
VOLATILE
NOT LEAKPROOF
CALLED ON NULL INPUT
LANGUAGE SQL
AS $$
SELECT 'hello';
$$
134 test_cross_db 135 public 136 f_cross_db CREATE FUNCTION public.f_cross_db()
RETURNS INT8
VOLATILE
NOT LEAKPROOF
CALLED ON NULL INPUT
LANGUAGE SQL
AS $$
SELECT 1;
$$
test public f CREATE FUNCTION public.f(IN INT8)
RETURNS INT8
VOLATILE
NOT LEAKPROOF
CALLED ON NULL INPUT
LANGUAGE SQL
AS $$
SELECT 1;
$$
test public f CREATE FUNCTION public.f(IN STRING, IN b INT8)
RETURNS STRING
IMMUTABLE
LEAKPROOF
STRICT
LANGUAGE SQL
AS $$
SELECT 'hello';
$$
test sc f2 CREATE FUNCTION sc.f2(IN STRING)
RETURNS STRING
VOLATILE
NOT LEAKPROOF
CALLED ON NULL INPUT
LANGUAGE SQL
AS $$
SELECT 'hello';
$$
test_cross_db public f_cross_db CREATE FUNCTION public.f_cross_db()
RETURNS INT8
VOLATILE
NOT LEAKPROOF
CALLED ON NULL INPUT
LANGUAGE SQL
AS $$
SELECT 1;
$$

skipif config local-mixed-22.2-23.1
statement ok
DROP PROCEDURE f(BOOL);

statement ok
DROP FUNCTION f(INT);
DROP FUNCTION f(STRING, INT);
DROP PROCEDURE f(BOOL);
DROP FUNCTION sc.f2(STRING);
DROP SCHEMA sc;
USE test_cross_db;
Expand All @@ -1566,23 +1570,29 @@ subtest end

subtest create_procedure_statements

skipif config local-mixed-22.2-23.1
statement ok
CREATE PROCEDURE p(INT) LANGUAGE SQL AS $$ SELECT 1 $$;

skipif config local-mixed-22.2-23.1
statement ok
CREATE PROCEDURE p(STRING, b INT) LANGUAGE SQL AS $$ SELECT 'hello' $$;

# Add a function to ensure that it doesn't show up in the
# create_procedure_statements table.
skipif config local-mixed-22.2-23.1
statement ok
CREATE FUNCTION p(BOOL) RETURNS INT LANGUAGE SQL AS $$ SELECT 1 $$;

skipif config local-mixed-22.2-23.1
statement ok
CREATE SCHEMA sc;

skipif config local-mixed-22.2-23.1
statement
CREATE PROCEDURE sc.p2(STRING) LANGUAGE SQL AS $$ SELECT 'hello' $$;

skipif config local-mixed-22.2-23.1
query ITITITT
SELECT database_id, database_name, schema_id, schema_name, procedure_id, procedure_name, create_statement
FROM crdb_internal.create_procedure_statements
Expand All @@ -1605,12 +1615,14 @@ ORDER BY procedure_id;
SELECT 'hello';
$$

skipif config local-mixed-22.2-23.1
statement ok
CREATE DATABASE test_cross_db;
USE test_cross_db;
CREATE PROCEDURE p_cross_db() LANGUAGE SQL AS $$ SELECT 1 $$;
USE test;

skipif config local-mixed-22.2-23.1
query ITITITT
SELECT database_id, database_name, schema_id, schema_name, procedure_id, procedure_name, create_statement
FROM "".crdb_internal.create_procedure_statements
Expand Down Expand Up @@ -1638,6 +1650,7 @@ ORDER BY procedure_id;
SELECT 1;
$$

skipif config local-mixed-22.2-23.1
statement ok
DROP PROCEDURE p(INT);
DROP PROCEDURE p(STRING, INT);
Expand Down
Loading

0 comments on commit 76a8d10

Please sign in to comment.