You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logictest: make schema_locked enabled for all tests
Previously, schema-locking was only tested under the local-schema-locked
setting. This patch removes the local-schema-locked configuration and
enables schema-locked by default for all configs except mixed-version
and legacy schema changer setups. A new config set,
schema-locked-disabled, has been added to skip schema-locking related
logic.
As part of this change, expected values in the execbuilder logictests
have been updated for schema_locked, and ccl logictests are now updated
to expect schema-locked tables by default.
Additionally, schema-locking is now bypassed for the following specific
cases:
- Transactional test cases.
- ALTER TABLE ... SET LOCALITY test cases, due to missing
declarative schema changer support.
Most of the logic test edits involve search and replace operations, such
as changing skipif config local-schema-locked to onlyif config
schema-locked-disabled.
Informs: #129694
Release note: None
crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region ON UPDATE rehome_row()::public.crdb_internal_region,
26
26
CONSTRAINT rbr_pkey PRIMARY KEY (p ASC)
27
-
) LOCALITY REGIONAL BY ROW;
27
+
) WITH (schema_locked = true) LOCALITY REGIONAL BY ROW;
28
28
29
29
30
+
# Locality cannot be modified with schema_locked set, until declarative
31
+
# schema changer support is added.
30
32
statement ok
31
-
CREATE TABLE db.rbr_altered (p INT PRIMARY KEY) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION
33
+
CREATE TABLE db.rbr_altered (p INT PRIMARY KEY) WITH (schema_locked=false) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION
32
34
33
35
statement ok
34
36
ALTER TABLE db.rbr_altered SET LOCALITY REGIONAL BY ROW
rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(),
1527
1545
CONSTRAINT t_as_pkey PRIMARY KEY (rowid ASC)
1528
-
) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION;
1546
+
) WITH (schema_locked = true) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION;
1547
+
1529
1548
1549
+
statement ok
1550
+
ALTER TABLE t_as SET (schema_locked = false);
1530
1551
1531
1552
statement error cannot use column crdb_region for REGIONAL BY ROW table as it may contain NULL values
1532
1553
ALTER TABLE t_as SET LOCALITY REGIONAL BY ROW AS crdb_region
1533
1554
1555
+
1556
+
statement ok
1557
+
ALTER TABLE t_as SET (schema_locked = true);
1558
+
1534
1559
statement ok
1535
1560
ALTER TABLE t_as ALTER COLUMN crdb_region SET NOT NULL
1536
1561
@@ -1540,9 +1565,15 @@ ALTER TABLE t_as ALTER COLUMN crdb_region SET NOT VISIBLE
1540
1565
statement ok
1541
1566
ALTER TABLE t_as ALTER COLUMN crdb_region SET DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region
1542
1567
1568
+
statement ok
1569
+
ALTER TABLE t_as SET (schema_locked = false);
1570
+
1543
1571
statement ok
1544
1572
ALTER TABLE t_as SET LOCALITY REGIONAL BY ROW AS crdb_region
1545
1573
1574
+
statement ok
1575
+
ALTER TABLE t_as SET (schema_locked = true);
1576
+
1546
1577
query T colnames
1547
1578
SELECT create_statement from [SHOW CREATE TABLE t_as]
1548
1579
----
@@ -1552,7 +1583,7 @@ CREATE TABLE public.t_as (
1552
1583
crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region,
1553
1584
rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(),
1554
1585
CONSTRAINT t_as_pkey PRIMARY KEY (rowid ASC)
1555
-
) LOCALITY REGIONAL BY ROW AS crdb_region;
1586
+
) WITH (schema_locked = true) LOCALITY REGIONAL BY ROW AS crdb_region;
1556
1587
1557
1588
query TI colnames,rowsort
1558
1589
SELECT crdb_region, i FROM t_as
@@ -1594,7 +1625,7 @@ CREATE TABLE public.t_as (
1594
1625
i INT8 NOT NULL,
1595
1626
crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region,
1596
1627
CONSTRAINT t_as_pkey PRIMARY KEY (i ASC)
1597
-
) LOCALITY REGIONAL BY ROW AS crdb_region;
1628
+
) WITH (schema_locked = true) LOCALITY REGIONAL BY ROW AS crdb_region;
1598
1629
1599
1630
query T colnames
1600
1631
SELECT create_statement from [SHOW CREATE TABLE t]
@@ -1604,7 +1635,7 @@ CREATE TABLE public.t (
1604
1635
i INT8 NOT NULL,
1605
1636
crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region,
1606
1637
CONSTRAINT t_pkey PRIMARY KEY (i ASC)
1607
-
) LOCALITY REGIONAL BY ROW;
1638
+
) WITH (schema_locked = true) LOCALITY REGIONAL BY ROW;
1608
1639
1609
1640
# Declare victory, as this is the closest we can get.
0 commit comments