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
148101: logictest: enable schema_locked by default for new tables r=fqazi a=fqazi
This PR enables schema-locked across the entire logic test suite by doing the following
1. Bypassing SET ZONE CONFIG and ALTER INDEX ... VISIBILITY operations
2. Enabling schema-locked by default on all tests and adding a new config set for the disabled config (local-legacy-schema-changer and local-mixed*). Also search and replacing local-schema-locked with this new config set where appropriate.
3. Updating execbuilder tests to take into account schema_locked. Tests with transactions will toggle schema_locked or avoid creating tables with it.
4. Updating CCL logictests to take into account schema_locked. schema_locked is only bypassed in cases where table locality is set.
Note: The final PR will squash the last 3 commits, since those are needed for a stable logic test. To make reviewing easier we have those changes split up.
Informs: #129694
Release note: None
Co-authored-by: Faizan Qazi <[email protected]>
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