diff --git a/pkg/ccl/backupccl/show_test.go b/pkg/ccl/backupccl/show_test.go index b78f8b177415..4d20984aec9a 100644 --- a/pkg/ccl/backupccl/show_test.go +++ b/pkg/ccl/backupccl/show_test.go @@ -236,8 +236,7 @@ ORDER BY object_type, object_name`, full) a INT8 NOT NULL, b INT8 NULL, CONSTRAINT tablea_pkey PRIMARY KEY (a ASC), - INDEX tablea_b_idx (b ASC), - FAMILY "primary" (a, b) + INDEX tablea_b_idx (b ASC) )` expectedCreateView := "CREATE VIEW viewa (\n\ta\n) AS SELECT a FROM data.public.tablea" expectedCreateSeq := `CREATE SEQUENCE seqa MINVALUE 1 MAXVALUE 20 INCREMENT 2 START 1` @@ -271,15 +270,13 @@ ORDER BY object_type, object_name`, full) a INT8 NOT NULL, b INT8 NULL, CONSTRAINT fkreftable_pkey PRIMARY KEY (a ASC), - CONSTRAINT fkreftable_b_fkey FOREIGN KEY (b) REFERENCES public.fksrc(a), - FAMILY "primary" (a, b) + CONSTRAINT fkreftable_b_fkey FOREIGN KEY (b) REFERENCES public.fksrc(a) )` wantDiffDB := `CREATE TABLE fkreftable ( a INT8 NOT NULL, b INT8 NULL, CONSTRAINT fkreftable_pkey PRIMARY KEY (a ASC), - CONSTRAINT fkreftable_b_fkey FOREIGN KEY (b) REFERENCES data.public.fksrc(a), - FAMILY "primary" (a, b) + CONSTRAINT fkreftable_b_fkey FOREIGN KEY (b) REFERENCES data.public.fksrc(a) )` showBackupRows = sqlDBRestore.QueryStr(t, fmt.Sprintf(`SELECT create_statement FROM [SHOW BACKUP SCHEMAS '%s'] WHERE object_type='table'`, includedFK)) @@ -303,8 +300,7 @@ ORDER BY object_type, object_name`, full) want := `CREATE TABLE fkreftable ( a INT8 NOT NULL, b INT8 NULL, - CONSTRAINT fkreftable_pkey PRIMARY KEY (a ASC), - FAMILY "primary" (a, b) + CONSTRAINT fkreftable_pkey PRIMARY KEY (a ASC) )` showBackupRows = sqlDBRestore.QueryStr(t, fmt.Sprintf(`SELECT create_statement FROM [SHOW BACKUP SCHEMAS '%s'] WHERE object_type='table'`, missingFK)) @@ -607,15 +603,15 @@ func showUpgradedForeignKeysTest(exportDir string) func(t *testing.T) { for _, tc := range []testCase{ { "circular", - "CONSTRAINT self_fk FOREIGN KEY \\(selfid\\) REFERENCES public\\.circular\\(selfid\\) NOT VALID,", + "CONSTRAINT self_fk FOREIGN KEY \\(selfid\\) REFERENCES public\\.circular\\(selfid\\) NOT VALID", }, { "child", - "CONSTRAINT \\w+ FOREIGN KEY \\(\\w+\\) REFERENCES public\\.parent\\(\\w+\\),", + "CONSTRAINT \\w+ FOREIGN KEY \\(\\w+\\) REFERENCES public\\.parent\\(\\w+\\)", }, { "child_pk", - "CONSTRAINT \\w+ FOREIGN KEY \\(\\w+\\) REFERENCES public\\.parent\\(\\w+\\),", + "CONSTRAINT \\w+ FOREIGN KEY \\(\\w+\\) REFERENCES public\\.parent\\(\\w+\\)", }, } { results := sqlDB.QueryStr(t, ` diff --git a/pkg/ccl/backupccl/testdata/backup-restore/virtual-columns b/pkg/ccl/backupccl/testdata/backup-restore/virtual-columns index 819cf7c9196f..3a64f4f37016 100644 --- a/pkg/ccl/backupccl/testdata/backup-restore/virtual-columns +++ b/pkg/ccl/backupccl/testdata/backup-restore/virtual-columns @@ -46,6 +46,5 @@ d.public.tab CREATE TABLE public.tab ( v INT8 NULL AS (a + b) VIRTUAL, CONSTRAINT tab_pkey PRIMARY KEY (k ASC), INDEX tab_v_idx (v ASC), - UNIQUE INDEX tab_a_b_key (a ASC, b ASC) WHERE v > 0:::INT8, - FAMILY "primary" (k, a, b) + UNIQUE INDEX tab_a_b_key (a ASC, b ASC) WHERE v > 0:::INT8 ) diff --git a/pkg/ccl/importccl/import_stmt_test.go b/pkg/ccl/importccl/import_stmt_test.go index eaf67d1d4f1f..6c502b67c408 100644 --- a/pkg/ccl/importccl/import_stmt_test.go +++ b/pkg/ccl/importccl/import_stmt_test.go @@ -877,14 +877,12 @@ END; k INT8 NULL, CONSTRAINT a_pkey PRIMARY KEY (i ASC), CONSTRAINT a_i_fkey FOREIGN KEY (i) REFERENCES public.b(j) NOT VALID, - CONSTRAINT a_k_fkey FOREIGN KEY (k) REFERENCES public.a(i) NOT VALID, - FAMILY "primary" (i, k) + CONSTRAINT a_k_fkey FOREIGN KEY (k) REFERENCES public.a(i) NOT VALID )`}, { `CREATE TABLE public.b ( j INT8 NOT NULL, CONSTRAINT b_pkey PRIMARY KEY (j ASC), - CONSTRAINT b_j_fkey FOREIGN KEY (j) REFERENCES public.a(i) NOT VALID, - FAMILY "primary" (j) + CONSTRAINT b_j_fkey FOREIGN KEY (j) REFERENCES public.a(i) NOT VALID )`, }}, @@ -996,8 +994,7 @@ END; `CREATE TABLE public.t ( a INT8 NOT NULL, b INT8 NOT NULL, - CONSTRAINT t_pkey PRIMARY KEY (a ASC), - FAMILY "primary" (a, b) + CONSTRAINT t_pkey PRIMARY KEY (a ASC) )`, }, }, @@ -1019,8 +1016,7 @@ END; a INT8 NOT NULL, b INT8 NOT VISIBLE NULL, c INT8 NULL, - CONSTRAINT t_pkey PRIMARY KEY (a ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT t_pkey PRIMARY KEY (a ASC) )`, }, }, @@ -1040,8 +1036,7 @@ END; `CREATE TABLE public.t ( a INT8 NOT NULL, b INT8 NULL DEFAULT 8:::INT8, - CONSTRAINT t_pkey PRIMARY KEY (a ASC), - FAMILY "primary" (a, b) + CONSTRAINT t_pkey PRIMARY KEY (a ASC) )`, }, }, @@ -1470,8 +1465,7 @@ END const ( testPgdumpCreateCities = `CREATE TABLE public.cities ( city VARCHAR(80) NOT NULL, - CONSTRAINT cities_pkey PRIMARY KEY (city ASC), - FAMILY "primary" (city) + CONSTRAINT cities_pkey PRIMARY KEY (city ASC) )` testPgdumpCreateWeather = `CREATE TABLE public.weather ( city VARCHAR(80) NULL, @@ -1481,8 +1475,7 @@ const ( date DATE NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT weather_pkey PRIMARY KEY (rowid ASC), - CONSTRAINT weather_city_fkey FOREIGN KEY (city) REFERENCES public.cities(city) NOT VALID, - FAMILY "primary" (city, temp_lo, temp_hi, prcp, date, rowid) + CONSTRAINT weather_city_fkey FOREIGN KEY (city) REFERENCES public.cities(city) NOT VALID )` testPgdumpFk = ` CREATE TABLE public.cities ( @@ -5479,8 +5472,7 @@ func TestImportPgDump(t *testing.T) { b BYTES NULL, CONSTRAINT simple_pkey PRIMARY KEY (i ASC), UNIQUE INDEX simple_b_s_idx (b ASC, s ASC), - INDEX simple_s_idx (s ASC), - FAMILY "primary" (i, s, b) + INDEX simple_s_idx (s ASC) )`, }}) @@ -5518,8 +5510,7 @@ func TestImportPgDump(t *testing.T) { "second", `CREATE TABLE public.second ( i INT8 NOT NULL, s STRING NULL, - CONSTRAINT second_pkey PRIMARY KEY (i ASC), - FAMILY "primary" (i, s) + CONSTRAINT second_pkey PRIMARY KEY (i ASC) )`, }}) res := sqlDB.QueryStr(t, "SELECT * FROM second ORDER BY i") @@ -5545,8 +5536,7 @@ func TestImportPgDump(t *testing.T) { a INT8 NULL DEFAULT nextval('public.a_seq'::REGCLASS), b INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT seqtable_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, rowid) + CONSTRAINT seqtable_pkey PRIMARY KEY (rowid ASC) )`, }}) sqlDB.CheckQueryResults(t, `SHOW CREATE SEQUENCE a_seq`, [][]string{{ @@ -6198,16 +6188,14 @@ func TestImportCockroachDump(t *testing.T) { i INT8 NOT NULL, t STRING NULL, CONSTRAINT "primary" PRIMARY KEY (i ASC), - INDEX t_t_idx (t ASC), - FAMILY "primary" (i, t) + INDEX t_t_idx (t ASC) )`}, }) sqlDB.CheckQueryResults(t, "SHOW CREATE TABLE a", [][]string{ {"a", `CREATE TABLE public.a ( i INT8 NOT NULL, CONSTRAINT "primary" PRIMARY KEY (i ASC), - CONSTRAINT fk_i_ref_t FOREIGN KEY (i) REFERENCES public.t(i) NOT VALID, - FAMILY "primary" (i) + CONSTRAINT fk_i_ref_t FOREIGN KEY (i) REFERENCES public.t(i) NOT VALID )`}, }) } diff --git a/pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality b/pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality index d4e499e3e31d..fbfd7ccda1c9 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality +++ b/pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality @@ -1224,8 +1224,7 @@ SHOW CREATE TABLE regional_by_table_no_region regional_by_table_no_region CREATE TABLE public.regional_by_table_no_region ( i INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT regional_by_table_no_region_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, rowid) + CONSTRAINT regional_by_table_no_region_pkey PRIMARY KEY (rowid ASC) ) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION query TTT @@ -1273,8 +1272,7 @@ SHOW CREATE TABLE regional_by_table_no_region regional_by_table_no_region CREATE TABLE public.regional_by_table_no_region ( i INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT regional_by_table_no_region_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, rowid) + CONSTRAINT regional_by_table_no_region_pkey PRIMARY KEY (rowid ASC) ) LOCALITY GLOBAL query TTT diff --git a/pkg/ccl/logictestccl/testdata/logic_test/auto_rehoming b/pkg/ccl/logictestccl/testdata/logic_test/auto_rehoming index fe900638df85..581d983896dd 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/auto_rehoming +++ b/pkg/ccl/logictestccl/testdata/logic_test/auto_rehoming @@ -23,8 +23,7 @@ db.public.rbr CREATE TABLE public.rbr ( p INT8 NOT NULL, s STRING NULL, 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, - CONSTRAINT rbr_pkey PRIMARY KEY (p ASC), - FAMILY "primary" (p, s, crdb_region) + CONSTRAINT rbr_pkey PRIMARY KEY (p ASC) ) LOCALITY REGIONAL BY ROW @@ -40,6 +39,5 @@ SHOW CREATE TABLE db.rbr_altered db.public.rbr_altered CREATE TABLE public.rbr_altered ( p INT8 NOT NULL, 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, - CONSTRAINT rbr_altered_pkey PRIMARY KEY (p ASC), - FAMILY "primary" (p, crdb_region) + CONSTRAINT rbr_altered_pkey PRIMARY KEY (p ASC) ) LOCALITY REGIONAL BY ROW diff --git a/pkg/ccl/logictestccl/testdata/logic_test/case_sensitive_names b/pkg/ccl/logictestccl/testdata/logic_test/case_sensitive_names index 3447ad9b9ba7..0d77bdbebdc5 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/case_sensitive_names +++ b/pkg/ccl/logictestccl/testdata/logic_test/case_sensitive_names @@ -12,8 +12,7 @@ SHOW CREATE TABLE p ---- p CREATE TABLE public.p ( a INT8 NOT NULL, - CONSTRAINT p_pkey PRIMARY KEY (a ASC), - FAMILY "primary" (a) + CONSTRAINT p_pkey PRIMARY KEY (a ASC) ) PARTITION BY LIST (a) ( PARTITION p1 VALUES IN ((1)), PARTITION "P1" VALUES IN ((2)), diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region b/pkg/ccl/logictestccl/testdata/logic_test/multi_region index 28b6bd835300..0f506d15d014 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region @@ -385,8 +385,7 @@ SELECT create_statement FROM [SHOW CREATE TABLE regional_primary_region_table] CREATE TABLE public.regional_primary_region_table ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT regional_primary_region_table_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT regional_primary_region_table_pkey PRIMARY KEY (rowid ASC) ) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION query TT @@ -421,8 +420,7 @@ SELECT create_statement FROM [SHOW CREATE TABLE regional_implicit_primary_region CREATE TABLE public.regional_implicit_primary_region_table ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT regional_implicit_primary_region_table_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT regional_implicit_primary_region_table_pkey PRIMARY KEY (rowid ASC) ) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION query TT @@ -447,8 +445,7 @@ SELECT create_statement FROM [SHOW CREATE TABLE "regional_us-east-1_table"] CREATE TABLE public."regional_us-east-1_table" ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT "regional_us-east-1_table_pkey" PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT "regional_us-east-1_table_pkey" PRIMARY KEY (rowid ASC) ) LOCALITY REGIONAL BY TABLE IN "us-east-1" query TT @@ -476,8 +473,7 @@ SELECT create_statement FROM [SHOW CREATE TABLE global_table] CREATE TABLE public.global_table ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT global_table_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT global_table_pkey PRIMARY KEY (rowid ASC) ) LOCALITY GLOBAL query TT @@ -1030,8 +1026,7 @@ SELECT create_statement FROM [SHOW CREATE TABLE no_initial_region.t] CREATE TABLE public.t ( k INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (k, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION statement ok @@ -1457,8 +1452,7 @@ CREATE TABLE public.t_as ( i INT8 NULL, crdb_region public.crdb_internal_region NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_as_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, crdb_region, rowid) + CONSTRAINT t_as_pkey PRIMARY KEY (rowid ASC) ) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION @@ -1485,8 +1479,7 @@ CREATE TABLE public.t_as ( i INT8 NULL, crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_as_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, crdb_region, rowid) + CONSTRAINT t_as_pkey PRIMARY KEY (rowid ASC) ) LOCALITY REGIONAL BY ROW AS crdb_region query TI colnames @@ -1528,8 +1521,7 @@ create_statement CREATE TABLE public.t_as ( i INT8 NOT NULL, crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region, - CONSTRAINT t_as_pkey PRIMARY KEY (i ASC), - FAMILY "primary" (i, crdb_region) + CONSTRAINT t_as_pkey PRIMARY KEY (i ASC) ) LOCALITY REGIONAL BY ROW AS crdb_region query T colnames @@ -1539,8 +1531,7 @@ create_statement CREATE TABLE public.t ( i INT8 NOT NULL, crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region, - CONSTRAINT t_pkey PRIMARY KEY (i ASC), - FAMILY "primary" (i, crdb_region) + CONSTRAINT t_pkey PRIMARY KEY (i ASC) ) LOCALITY REGIONAL BY ROW # Declare victory, as this is the closest we can get. diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_backup b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_backup index 9b384e5bf0f7..dee4eddaa12e 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_backup +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_backup @@ -1241,8 +1241,7 @@ SHOW CREATE TABLE non_mr_table non_mr_table CREATE TABLE public.non_mr_table ( i INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT non_mr_table_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, rowid) + CONSTRAINT non_mr_table_pkey PRIMARY KEY (rowid ASC) ) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_import_export b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_import_export index 703d75d3b577..84c2e2217202 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_import_export +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_import_export @@ -99,6 +99,5 @@ team CREATE TABLE public.team ( name STRING NULL, likes STRING[] NULL, dislikes STRING[] NULL, - CONSTRAINT team_pkey PRIMARY KEY (id ASC), - FAMILY "primary" (id, name, likes, dislikes) + CONSTRAINT team_pkey PRIMARY KEY (id ASC) ) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION diff --git a/pkg/ccl/logictestccl/testdata/logic_test/partitioning b/pkg/ccl/logictestccl/testdata/logic_test/partitioning index 5a2eddd1015e..89fdd9272609 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/partitioning +++ b/pkg/ccl/logictestccl/testdata/logic_test/partitioning @@ -390,8 +390,7 @@ ok1 CREATE TABLE public.ok1 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NULL, - CONSTRAINT ok1_pkey PRIMARY KEY (a ASC, b ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT ok1_pkey PRIMARY KEY (a ASC, b ASC) ) PARTITION BY LIST (a) ( PARTITION p1 VALUES IN ((1)), PARTITION p2 VALUES IN ((2)) @@ -443,8 +442,7 @@ ok2 CREATE TABLE public.ok2 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NULL, - CONSTRAINT ok2_pkey PRIMARY KEY (a ASC, b ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT ok2_pkey PRIMARY KEY (a ASC, b ASC) ) PARTITION BY LIST (a) ( PARTITION p1 VALUES IN ((1)), PARTITION p2 VALUES IN ((2)) @@ -491,8 +489,7 @@ ok3 CREATE TABLE public.ok3 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NULL, - CONSTRAINT ok3_pkey PRIMARY KEY (a ASC, b ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT ok3_pkey PRIMARY KEY (a ASC, b ASC) ) PARTITION BY LIST (a) ( PARTITION p1 VALUES IN ((1)), PARTITION p2 VALUES IN ((DEFAULT)) @@ -541,8 +538,7 @@ ok4 CREATE TABLE public.ok4 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NULL, - CONSTRAINT ok4_pkey PRIMARY KEY (a ASC, b ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT ok4_pkey PRIMARY KEY (a ASC, b ASC) ) PARTITION BY LIST (a, b) ( PARTITION p1 VALUES IN ((1, 1)), PARTITION p2 VALUES IN ((1, DEFAULT)), @@ -631,8 +627,7 @@ ok5 CREATE TABLE public.ok5 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NULL, - CONSTRAINT ok5_pkey PRIMARY KEY (a ASC, b ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT ok5_pkey PRIMARY KEY (a ASC, b ASC) ) PARTITION BY LIST (a) ( PARTITION p1 VALUES IN ((1)) PARTITION BY LIST (b) ( PARTITION p1_1 VALUES IN ((1)), @@ -664,8 +659,7 @@ ok6 CREATE TABLE public.ok6 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NULL, - CONSTRAINT ok6_pkey PRIMARY KEY (a ASC, b ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT ok6_pkey PRIMARY KEY (a ASC, b ASC) ) PARTITION BY RANGE (a) ( PARTITION p1 VALUES FROM (0) TO (1), PARTITION p2 VALUES FROM (1) TO (2) @@ -702,8 +696,7 @@ ok7 CREATE TABLE public.ok7 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NULL, - CONSTRAINT ok7_pkey PRIMARY KEY (a ASC, b ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT ok7_pkey PRIMARY KEY (a ASC, b ASC) ) PARTITION BY RANGE (a) ( PARTITION p1 VALUES FROM (0) TO (1) ) @@ -743,8 +736,7 @@ ok8 CREATE TABLE public.ok8 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NULL, - CONSTRAINT ok8_pkey PRIMARY KEY (a ASC, b ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT ok8_pkey PRIMARY KEY (a ASC, b ASC) ) PARTITION BY RANGE (a) ( PARTITION p1 VALUES FROM (MINVALUE) TO (1), PARTITION p2 VALUES FROM (1) TO (2), @@ -787,8 +779,7 @@ ok9 CREATE TABLE public.ok9 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NULL, - CONSTRAINT ok9_pkey PRIMARY KEY (a ASC, b ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT ok9_pkey PRIMARY KEY (a ASC, b ASC) ) PARTITION BY RANGE (a, b) ( PARTITION p1 VALUES FROM (MINVALUE, MINVALUE) TO (1, MAXVALUE), PARTITION p2 VALUES FROM (1, MAXVALUE) TO (3, MINVALUE), @@ -833,8 +824,7 @@ ok10 CREATE TABLE public.ok10 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NULL, - CONSTRAINT ok10_pkey PRIMARY KEY (a ASC, b ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT ok10_pkey PRIMARY KEY (a ASC, b ASC) ) PARTITION BY RANGE (a, b) ( PARTITION p1 VALUES FROM (MINVALUE, MINVALUE) TO (1, 1), PARTITION p2 VALUES FROM (1, 1) TO (1, MAXVALUE), @@ -885,8 +875,7 @@ ok11 CREATE TABLE public.ok11 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NOT NULL, - CONSTRAINT ok11_pkey PRIMARY KEY (a ASC, b ASC, c ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT ok11_pkey PRIMARY KEY (a ASC, b ASC, c ASC) ) PARTITION BY LIST (a) ( PARTITION p1 VALUES IN ((1)) PARTITION BY LIST (b) ( PARTITION p1_1 VALUES IN ((3)) PARTITION BY LIST (c) ( @@ -942,8 +931,7 @@ ok12 CREATE TABLE public.ok12 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NULL, - CONSTRAINT ok12_pkey PRIMARY KEY (a ASC, b ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT ok12_pkey PRIMARY KEY (a ASC, b ASC) ) PARTITION BY LIST (a) ( PARTITION pu VALUES IN ((NULL)), PARTITION p1 VALUES IN ((1)), diff --git a/pkg/ccl/logictestccl/testdata/logic_test/partitioning_index b/pkg/ccl/logictestccl/testdata/logic_test/partitioning_index index 5a955b5554a1..666807fc3e1c 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/partitioning_index +++ b/pkg/ccl/logictestccl/testdata/logic_test/partitioning_index @@ -20,8 +20,7 @@ ok1 CREATE TABLE public.ok1 ( INDEX ok1_b_idx (b ASC) PARTITION BY LIST (b) ( PARTITION p1 VALUES IN ((1)), PARTITION pu VALUES IN ((NULL)) - ), - FAMILY "primary" (a, b) + ) ) -- Warning: Partitioned table with no zone configurations. @@ -48,8 +47,7 @@ ok2 CREATE TABLE public.ok2 ( CONSTRAINT ok2_pkey PRIMARY KEY (a ASC), UNIQUE INDEX ok2_b_key (b ASC) PARTITION BY LIST (b) ( PARTITION p1 VALUES IN ((1)) - ), - FAMILY "primary" (a, b) + ) ) -- Warning: Partitioned table with no zone configurations. @@ -82,8 +80,7 @@ ok3 CREATE TABLE public.ok3 ( ), UNIQUE INDEX ok3_b_key2 (b ASC) PARTITION BY LIST (b) ( PARTITION p2 VALUES IN ((1)) - ), - FAMILY "primary" (a, b) + ) ) -- Warning: Partitioned table with no zone configurations. @@ -146,8 +143,7 @@ indexes CREATE TABLE public.indexes ( ), INDEX i5 (b ASC) PARTITION BY LIST (b) ( PARTITION p1 VALUES IN ((1)) - ), - FAMILY "primary" (a, b) + ) ) -- Warning: Partitioned table with no zone configurations. @@ -180,8 +176,7 @@ inverted CREATE TABLE public.inverted ( ), INVERTED INDEX inv_idx (b, j) PARTITION BY LIST (b) ( PARTITION p1 VALUES IN ((1)) - ), - FAMILY "primary" (a, b, j) + ) ) -- Warning: Partitioned table with no zone configurations. diff --git a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row index 06d0b3a433db..1f8cfabbb6c3 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row +++ b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row @@ -622,8 +622,7 @@ SELECT create_statement FROM [SHOW CREATE TABLE regional_by_row_table_pk_defined CREATE TABLE public.regional_by_row_table_pk_defined_separately ( pk INT8 NOT NULL, crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region, - CONSTRAINT "primary" PRIMARY KEY (pk ASC), - FAMILY "primary" (pk, crdb_region) + CONSTRAINT "primary" PRIMARY KEY (pk ASC) ) LOCALITY REGIONAL BY ROW # Tests for REGIONAL BY TABLE AS @@ -1277,8 +1276,7 @@ regional_by_row_like CREATE TABLE public.regional_by_ i INT8 NULL, crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT regional_by_row_like_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (pk, i, crdb_region, rowid) + CONSTRAINT regional_by_row_like_pkey PRIMARY KEY (rowid ASC) ) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION statement ok @@ -1293,8 +1291,7 @@ regional_by_row_like CREATE TABLE public.regional_by_ i INT8 NULL, crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region, CONSTRAINT regional_by_row_pkey PRIMARY KEY (crdb_region ASC, pk ASC), - INDEX regional_by_row_i_idx (crdb_region ASC, i ASC), - FAMILY "primary" (pk, i, crdb_region) + INDEX regional_by_row_i_idx (crdb_region ASC, i ASC) ) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION @@ -1310,8 +1307,7 @@ regional_by_row_like CREATE TABLE public.regional_by_ i INT8 NULL, crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region, CONSTRAINT regional_by_row_pkey PRIMARY KEY (crdb_region ASC, pk ASC), - INDEX regional_by_row_i_idx (crdb_region ASC, i ASC), - FAMILY "primary" (pk, i, crdb_region) + INDEX regional_by_row_i_idx (crdb_region ASC, i ASC) ) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/zone b/pkg/ccl/logictestccl/testdata/logic_test/zone index 82747cf50328..7201f7123194 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/zone +++ b/pkg/ccl/logictestccl/testdata/logic_test/zone @@ -639,8 +639,7 @@ SHOW CREATE TABLE show_test ---- show_test CREATE TABLE public.show_test ( x INT8 NOT NULL, - CONSTRAINT show_test_pkey PRIMARY KEY (x ASC), - FAMILY "primary" (x) + CONSTRAINT show_test_pkey PRIMARY KEY (x ASC) ) PARTITION BY LIST (x) ( PARTITION p1 VALUES IN ((1)), PARTITION p2 VALUES IN ((2)) @@ -662,8 +661,7 @@ SHOW CREATE warning ---- warning CREATE TABLE public.warning ( x INT8 NOT NULL, - CONSTRAINT warning_pkey PRIMARY KEY (x ASC), - FAMILY "primary" (x) + CONSTRAINT warning_pkey PRIMARY KEY (x ASC) ) PARTITION BY LIST (x) ( PARTITION p1 VALUES IN ((1)) ) @@ -741,8 +739,7 @@ SHOW CREATE TABLE t40417 ---- t40417 CREATE TABLE public.t40417 ( x INT8 NOT NULL, - CONSTRAINT t40417_pkey PRIMARY KEY (x ASC), - FAMILY "primary" (x) + CONSTRAINT t40417_pkey PRIMARY KEY (x ASC) ) PARTITION BY LIST (x) ( PARTITION p1 VALUES IN ((1)) ); diff --git a/pkg/ccl/multiregionccl/show_test.go b/pkg/ccl/multiregionccl/show_test.go index e0bd613d18fd..748cce0c04a6 100644 --- a/pkg/ccl/multiregionccl/show_test.go +++ b/pkg/ccl/multiregionccl/show_test.go @@ -31,8 +31,7 @@ func TestShowCreateTable(t *testing.T) { Expect: `CREATE TABLE public.%[1]s ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC) ) LOCALITY GLOBAL`, Database: "mrdb", }, @@ -44,8 +43,7 @@ func TestShowCreateTable(t *testing.T) { Expect: `CREATE TABLE public.%[1]s ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC) ) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION`, Database: "mrdb", }, @@ -56,8 +54,7 @@ func TestShowCreateTable(t *testing.T) { Expect: `CREATE TABLE public.%[1]s ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC) ) LOCALITY REGIONAL BY TABLE IN "us-west1"`, Database: "mrdb", }, @@ -72,8 +69,7 @@ func TestShowCreateTable(t *testing.T) { crdb_region public.crdb_internal_region NOT VISIBLE NOT NULL DEFAULT default_to_database_primary_region(gateway_region())::public.crdb_internal_region, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), - INDEX a_idx (a ASC), - FAMILY "primary" (a, crdb_region, rowid) + INDEX a_idx (a ASC) ) LOCALITY REGIONAL BY ROW`, Database: "mrdb", }, @@ -88,8 +84,7 @@ func TestShowCreateTable(t *testing.T) { crdb_region_col public.crdb_internal_region NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), - INDEX a_idx (a ASC), - FAMILY "primary" (a, crdb_region_col, rowid) + INDEX a_idx (a ASC) ) LOCALITY REGIONAL BY ROW AS crdb_region_col`, Database: "mrdb", }, @@ -104,8 +99,7 @@ func TestShowCreateTable(t *testing.T) { crdb_region_col public.crdb_internal_region NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), - INDEX a_idx (a ASC) WHERE a > 0:::INT8, - FAMILY "primary" (a, crdb_region_col, rowid) + INDEX a_idx (a ASC) WHERE a > 0:::INT8 ) LOCALITY REGIONAL BY ROW AS crdb_region_col`, Database: "mrdb", }, diff --git a/pkg/migration/migrations/descriptor_utils_test.go b/pkg/migration/migrations/descriptor_utils_test.go index 639c4eccbd83..14ba90a12cc5 100644 --- a/pkg/migration/migrations/descriptor_utils_test.go +++ b/pkg/migration/migrations/descriptor_utils_test.go @@ -35,8 +35,7 @@ func TestCreateSystemTable(t *testing.T) { fakeTableSchema := `CREATE TABLE public.fake_table ( id UUID NOT NULL, - CONSTRAINT "primary" PRIMARY KEY (id ASC), - FAMILY "primary" (id) + CONSTRAINT "primary" PRIMARY KEY (id ASC) )` fakeTable := descpb.TableDescriptor{ Name: "fake_table", diff --git a/pkg/sql/alter_column_type_test.go b/pkg/sql/alter_column_type_test.go index a41b8fbd565b..da238f7b1dd7 100644 --- a/pkg/sql/alter_column_type_test.go +++ b/pkg/sql/alter_column_type_test.go @@ -231,8 +231,7 @@ INSERT INTO t.test VALUES (1), (2), (3); `CREATE TABLE public.test ( x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT test_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT test_pkey PRIMARY KEY (rowid ASC) )`}} sqlDB.CheckQueryResults(t, "SHOW CREATE TABLE t.test", expected) @@ -245,8 +244,7 @@ INSERT INTO t.test VALUES (1), (2), (3); `CREATE TABLE public.test ( x STRING NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT test_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT test_pkey PRIMARY KEY (rowid ASC) )`}} sqlDB.CheckQueryResults(t, "SHOW CREATE TABLE t.test", expected) diff --git a/pkg/sql/catalog/tabledesc/table_desc_builder.go b/pkg/sql/catalog/tabledesc/table_desc_builder.go index 31487e7f7f0c..95555dd83d67 100644 --- a/pkg/sql/catalog/tabledesc/table_desc_builder.go +++ b/pkg/sql/catalog/tabledesc/table_desc_builder.go @@ -464,6 +464,10 @@ func maybeUpgradeFormatVersion(desc *descpb.TableDescriptor) (wasUpgraded bool) return wasUpgraded } +// FamilyPrimaryName is the name of the "primary" family, which is autogenerated +// the family clause is not specified. +const FamilyPrimaryName = "primary" + func upgradeToFamilyFormatVersion(desc *descpb.TableDescriptor) { var primaryIndexColumnIDs catalog.TableColSet for _, colID := range desc.PrimaryIndex.KeyColumnIDs { @@ -471,7 +475,7 @@ func upgradeToFamilyFormatVersion(desc *descpb.TableDescriptor) { } desc.Families = []descpb.ColumnFamilyDescriptor{ - {ID: 0, Name: "primary"}, + {ID: 0, Name: FamilyPrimaryName}, } desc.NextFamilyID = desc.Families[0].ID + 1 addFamilyForCol := func(col *descpb.ColumnDescriptor) { diff --git a/pkg/sql/logictest/testdata/logic_test/alter_column_type b/pkg/sql/logictest/testdata/logic_test/alter_column_type index ce2470a37400..e52e882368e4 100644 --- a/pkg/sql/logictest/testdata/logic_test/alter_column_type +++ b/pkg/sql/logictest/testdata/logic_test/alter_column_type @@ -75,8 +75,7 @@ t CREATE TABLE public.t ( a INT8 NOT NULL, i INT8 NULL, CONSTRAINT t_pkey PRIMARY KEY (a ASC), - INDEX idx2 (i ASC), - FAMILY "primary" (a, i) + INDEX idx2 (i ASC) ) statement ok @@ -286,8 +285,7 @@ SHOW CREATE TABLE t8 t8 CREATE TABLE public.t8 ( x STRING NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t8_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t8_pkey PRIMARY KEY (rowid ASC) ) # Ensure ALTER COLUMN TYPE is disallowed if column is part of primary key. @@ -445,8 +443,7 @@ table_name create_statement t24 CREATE TABLE public.t24 ( x STRING NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t24_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t24_pkey PRIMARY KEY (rowid ASC) ) # Ensure USING EXPRESSION rolls back if the USING EXPRESSION does not conform diff --git a/pkg/sql/logictest/testdata/logic_test/alter_primary_key b/pkg/sql/logictest/testdata/logic_test/alter_primary_key index 9722fb0c0e4b..c35d0bf74baa 100644 --- a/pkg/sql/logictest/testdata/logic_test/alter_primary_key +++ b/pkg/sql/logictest/testdata/logic_test/alter_primary_key @@ -450,8 +450,7 @@ SHOW CREATE t t CREATE TABLE public.t ( rowid INT8 NOT NULL, rowid_1 INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid_1 ASC), - FAMILY "primary" (rowid, rowid_1) + CONSTRAINT t_pkey PRIMARY KEY (rowid_1 ASC) ) statement ok @@ -463,8 +462,7 @@ SHOW CREATE t t CREATE TABLE public.t ( rowid INT8 NOT NULL, rowid_1 INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (rowid, rowid_1) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ) # Regression for old primary key not using PrimaryIndexEncoding as its encoding type. @@ -535,8 +533,7 @@ SHOW CREATE t t CREATE TABLE public.t ( x INT8 NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (x ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (x ASC) ) statement ok @@ -551,8 +548,7 @@ t CREATE TABLE public.t ( x INT8 NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), crdb_internal_x_shard_4 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(x)), 4:::INT8)) VIRTUAL, - CONSTRAINT t_pkey PRIMARY KEY (x ASC) USING HASH WITH (bucket_count=4), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (x ASC) USING HASH WITH (bucket_count=4) ) statement ok @@ -566,8 +562,7 @@ SHOW CREATE t t CREATE TABLE public.t ( x INT8 NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT my_pk PRIMARY KEY (x ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT my_pk PRIMARY KEY (x ASC) ) statement ok @@ -944,8 +939,7 @@ t CREATE TABLE public.t ( crdb_internal_x_shard_2 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(x)), 2:::INT8)) VIRTUAL, x INT8 NOT NULL, crdb_internal_x_shard_3 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(x)), 3:::INT8)) VIRTUAL, - CONSTRAINT t_pkey PRIMARY KEY (x ASC) USING HASH WITH (bucket_count=3), - FAMILY "primary" (x) + CONSTRAINT t_pkey PRIMARY KEY (x ASC) USING HASH WITH (bucket_count=3) ) # Changes on a hash sharded index that change the columns will cause the old @@ -1236,13 +1230,12 @@ query T SELECT @2 FROM [SHOW CREATE TABLE t]; ---- CREATE TABLE public.t ( - a INT8 NOT NULL, - b INT8 NOT NULL, - k INT8 NOT NULL AS (a + b) VIRTUAL, - CONSTRAINT t_pkey PRIMARY KEY (k ASC), - UNIQUE INDEX t_a_key (a ASC), - INDEX t_idx_b_k (b ASC, k ASC), - FAMILY "primary" (a, b) + a INT8 NOT NULL, + b INT8 NOT NULL, + k INT8 NOT NULL AS (a + b) VIRTUAL, + CONSTRAINT t_pkey PRIMARY KEY (k ASC), + UNIQUE INDEX t_a_key (a ASC), + INDEX t_idx_b_k (b ASC, k ASC) ) query III colnames,rowsort @@ -1273,14 +1266,13 @@ query T SELECT @2 FROM [SHOW CREATE TABLE t]; ---- CREATE TABLE public.t ( - a INT8 NOT NULL, - b INT8 NOT NULL, - k INT8 NOT NULL AS (a + b) VIRTUAL, - CONSTRAINT t_pkey PRIMARY KEY (b ASC, k ASC), - UNIQUE INDEX t_k_key (k ASC), - UNIQUE INDEX t_a_key (a ASC), - INDEX t_idx_b_k (b ASC, k ASC), - FAMILY "primary" (a, b) + a INT8 NOT NULL, + b INT8 NOT NULL, + k INT8 NOT NULL AS (a + b) VIRTUAL, + CONSTRAINT t_pkey PRIMARY KEY (b ASC, k ASC), + UNIQUE INDEX t_k_key (k ASC), + UNIQUE INDEX t_a_key (a ASC), + INDEX t_idx_b_k (b ASC, k ASC) ) query III colnames,rowsort @@ -1318,15 +1310,14 @@ query T SELECT @2 FROM [SHOW CREATE TABLE t]; ---- CREATE TABLE public.t ( - a INT8 NOT NULL, - b INT8 NOT NULL, - k INT8 NOT NULL AS (a + b) VIRTUAL, - CONSTRAINT t_pkey PRIMARY KEY (a ASC), - UNIQUE INDEX t_b_k_key (b ASC, k ASC), - UNIQUE INDEX t_k_key (k ASC), - UNIQUE INDEX t_a_key (a ASC), - INDEX t_idx_b_k (b ASC, k ASC), - FAMILY "primary" (a, b) + a INT8 NOT NULL, + b INT8 NOT NULL, + k INT8 NOT NULL AS (a + b) VIRTUAL, + CONSTRAINT t_pkey PRIMARY KEY (a ASC), + UNIQUE INDEX t_b_k_key (b ASC, k ASC), + UNIQUE INDEX t_k_key (k ASC), + UNIQUE INDEX t_a_key (a ASC), + INDEX t_idx_b_k (b ASC, k ASC) ) query III colnames,rowsort diff --git a/pkg/sql/logictest/testdata/logic_test/alter_table b/pkg/sql/logictest/testdata/logic_test/alter_table index 5ff79f344aa0..3c74ce98db30 100644 --- a/pkg/sql/logictest/testdata/logic_test/alter_table +++ b/pkg/sql/logictest/testdata/logic_test/alter_table @@ -816,8 +816,7 @@ show create table decomputed_column decomputed_column CREATE TABLE public.decomputed_column ( a INT8 NOT NULL, b INT8 NULL, - CONSTRAINT decomputed_column_pkey PRIMARY KEY (a ASC), - FAMILY "primary" (a, b) + CONSTRAINT decomputed_column_pkey PRIMARY KEY (a ASC) ) # Test for https://github.com/cockroachdb/cockroach/issues/26483 @@ -1154,8 +1153,7 @@ t2 CREATE TABLE public.t2 ( rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), x INT8 NULL, CONSTRAINT t2_pkey PRIMARY KEY (rowid ASC), - CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t1(x), - FAMILY "primary" (y, rowid, x) + CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t1(x) ) # Test that only one index gets created when adding a column @@ -1175,8 +1173,7 @@ t3 CREATE TABLE public.t3 ( x INT8 NULL, CONSTRAINT t3_pkey PRIMARY KEY (rowid ASC), CONSTRAINT t3_x_fkey FOREIGN KEY (x) REFERENCES public.t1(x), - UNIQUE INDEX t3_x_key (x ASC), - FAMILY "primary" (y, rowid, x) + UNIQUE INDEX t3_x_key (x ASC) ) # We allowed the foreign key validation code to look into the mutations @@ -1211,8 +1208,7 @@ t1 CREATE TABLE public.t1 ( x INT8 NOT NULL, x2 INT8 NULL, CONSTRAINT t1_pkey PRIMARY KEY (x ASC), - CONSTRAINT t1_x2_fkey FOREIGN KEY (x2) REFERENCES public.t1(x), - FAMILY "primary" (x, x2) + CONSTRAINT t1_x2_fkey FOREIGN KEY (x2) REFERENCES public.t1(x) ) statement error pq: insert on table "t1" violates foreign key constraint "t1_x2_fkey" @@ -1237,8 +1233,7 @@ t2 CREATE TABLE public.t2 ( rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), x INT8 NULL, CONSTRAINT t2_pkey PRIMARY KEY (rowid ASC), - CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t1(x) NOT VALID, - FAMILY "primary" (y, rowid, x) + CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t1(x) NOT VALID ) # Test that we can also add a column and then an FK in the same txn. @@ -1261,8 +1256,7 @@ t2 CREATE TABLE public.t2 ( rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), x INT8 NULL, CONSTRAINT t2_pkey PRIMARY KEY (rowid ASC), - CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t1(x) NOT VALID, - FAMILY "primary" (y, rowid, x) + CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t1(x) NOT VALID ) # Test that we can add a column and an index to an FK in the same txn. @@ -1289,8 +1283,7 @@ t2 CREATE TABLE public.t2 ( x INT8 NULL, CONSTRAINT t2_pkey PRIMARY KEY (rowid ASC), CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t1(x) NOT VALID, - INDEX t2_x_idx (x ASC), - FAMILY "primary" (y, rowid, x) + INDEX t2_x_idx (x ASC) ) # Test the above on a table not created in the same txn. @@ -1315,8 +1308,7 @@ t2 CREATE TABLE public.t2 ( x INT8 NULL, CONSTRAINT t2_pkey PRIMARY KEY (rowid ASC), CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t1(x), - INDEX t2_x_idx (x ASC), - FAMILY "primary" (y, rowid, x) + INDEX t2_x_idx (x ASC) ) # Test that an FK can use a newly created index. @@ -1339,8 +1331,7 @@ t2 CREATE TABLE public.t2 ( rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT t2_pkey PRIMARY KEY (rowid ASC), CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t1(x), - INDEX t2_x_idx (x ASC), - FAMILY "primary" (x, rowid) + INDEX t2_x_idx (x ASC) ) # Test when default column value leads to an FK violation. @@ -1369,8 +1360,7 @@ t2 CREATE TABLE public.t2 ( x INT8 NULL DEFAULT 1:::INT8, CONSTRAINT t2_pkey PRIMARY KEY (rowid ASC), CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t1(x), - UNIQUE INDEX t2_x_key (x ASC), - FAMILY "primary" (y, rowid, x) + UNIQUE INDEX t2_x_key (x ASC) ) # Regression 50069, computed exprs must only refer to columns inside the @@ -1807,8 +1797,7 @@ SHOW CREATE TABLE visible_table ---- visible_table CREATE TABLE public.visible_table ( a INT8 NOT NULL, - CONSTRAINT visible_table_pkey PRIMARY KEY (a ASC), - FAMILY "primary" (a) + CONSTRAINT visible_table_pkey PRIMARY KEY (a ASC) ) statement ok @@ -1819,8 +1808,7 @@ SHOW CREATE TABLE visible_table ---- visible_table CREATE TABLE public.visible_table ( a INT8 NOT VISIBLE NOT NULL, - CONSTRAINT visible_table_pkey PRIMARY KEY (a ASC), - FAMILY "primary" (a) + CONSTRAINT visible_table_pkey PRIMARY KEY (a ASC) ) subtest if_table_exists_already @@ -1917,8 +1905,7 @@ t CREATE TABLE public.t ( b INT8 NOT NULL GENERATED ALWAYS AS IDENTITY, c INT8 NOT NULL GENERATED BY DEFAULT AS IDENTITY, CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - UNIQUE INDEX t_a_key (a ASC), - FAMILY "primary" (a, rowid, b, c) + UNIQUE INDEX t_a_key (a ASC) ) statement ok @@ -1981,8 +1968,7 @@ t CREATE TABLE public.t ( b INT8 NOT NULL GENERATED BY DEFAULT AS IDENTITY (START 1 INCREMENT 3), c INT8 NOT NULL GENERATED BY DEFAULT AS IDENTITY (START 1 INCREMENT 3 CACHE 10), CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - UNIQUE INDEX t_a_key (a ASC), - FAMILY "primary" (a, rowid, b, c) + UNIQUE INDEX t_a_key (a ASC) ) statement ok @@ -2029,8 +2015,7 @@ SHOW CREATE TABLE t t CREATE TABLE public.t ( id INT8 NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (id ASC), - FAMILY "primary" (id, rowid) + CONSTRAINT t_pkey PRIMARY KEY (id ASC) ) # Table has a PRIMARY KEY named index; check it errors when assinging PRIMARY KEY to id. diff --git a/pkg/sql/logictest/testdata/logic_test/array b/pkg/sql/logictest/testdata/logic_test/array index 0a4bd3a81f48..7e3bb8b96f44 100644 --- a/pkg/sql/logictest/testdata/logic_test/array +++ b/pkg/sql/logictest/testdata/logic_test/array @@ -467,8 +467,7 @@ SHOW CREATE TABLE a a CREATE TABLE public.a ( b INT8[] NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT a_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (b, rowid) + CONSTRAINT a_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -528,8 +527,7 @@ SHOW CREATE TABLE a a CREATE TABLE public.a ( b INT8[] NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT a_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (b, rowid) + CONSTRAINT a_pkey PRIMARY KEY (rowid ASC) ) statement error could not parse "foo" as type int @@ -601,8 +599,7 @@ SHOW CREATE TABLE a a CREATE TABLE public.a ( b INT2[] NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT a_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (b, rowid) + CONSTRAINT a_pkey PRIMARY KEY (rowid ASC) ) statement error integer out of range for type int2 diff --git a/pkg/sql/logictest/testdata/logic_test/bit b/pkg/sql/logictest/testdata/logic_test/bit index 00a19befedc0..90fe34b90313 100644 --- a/pkg/sql/logictest/testdata/logic_test/bit +++ b/pkg/sql/logictest/testdata/logic_test/bit @@ -21,8 +21,7 @@ bits CREATE TABLE public.bits ( c VARBIT NULL, d VARBIT(4) NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT bits_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, d, rowid) + CONSTRAINT bits_pkey PRIMARY KEY (rowid ASC) ) subtest bit_fixed1 @@ -269,8 +268,7 @@ SELECT create_statement FROM [SHOW CREATE obitsa] CREATE TABLE public.obitsa ( x VARBIT(20)[] NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT obitsa_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT obitsa_pkey PRIMARY KEY (rowid ASC) ) # Check unindexed ordering. diff --git a/pkg/sql/logictest/testdata/logic_test/check_constraints b/pkg/sql/logictest/testdata/logic_test/check_constraints index 23f4cd6f07f9..4e959ba20498 100644 --- a/pkg/sql/logictest/testdata/logic_test/check_constraints +++ b/pkg/sql/logictest/testdata/logic_test/check_constraints @@ -221,7 +221,6 @@ t7 CREATE TABLE public.t7 ( z INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT t7_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, y, z, rowid), CONSTRAINT check_x CHECK (x > 0:::INT8), CONSTRAINT check_x_y CHECK ((x + y) > 0:::INT8), CONSTRAINT check_y_z CHECK ((y + z) > 0:::INT8), @@ -258,7 +257,6 @@ t8 CREATE TABLE public.t8 ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT t8_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid), CONSTRAINT check_a CHECK (a > 0:::INT8), CONSTRAINT check_a1 CHECK (a > 0:::INT8), CONSTRAINT check_a2 CHECK (a > 0:::INT8) diff --git a/pkg/sql/logictest/testdata/logic_test/collatedstring b/pkg/sql/logictest/testdata/logic_test/collatedstring index 14eb1c96d702..0a889df11dc1 100644 --- a/pkg/sql/logictest/testdata/logic_test/collatedstring +++ b/pkg/sql/logictest/testdata/logic_test/collatedstring @@ -218,8 +218,7 @@ SHOW CREATE TABLE t t CREATE TABLE public.t ( a STRING COLLATE en NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -368,8 +367,7 @@ quoted_coll CREATE TABLE public.quoted_coll ( d STRING COLLATE en_u_ks_level1 NULL DEFAULT 'd':::STRING COLLATE en_u_ks_level1, e STRING COLLATE en_US NULL AS (a COLLATE en_US) STORED, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT quoted_coll_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, d, e, rowid) + CONSTRAINT quoted_coll_pkey PRIMARY KEY (rowid ASC) ) # Regression for #46570. @@ -471,8 +469,7 @@ SHOW CREATE TABLE collation_name_case collation_name_case CREATE TABLE public.collation_name_case ( s STRING COLLATE en_US_u_ks_level2 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT collation_name_case_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (s, rowid) + CONSTRAINT collation_name_case_pkey PRIMARY KEY (rowid ASC) ) statement error invalid locale en-US-u-ks-le"vel2: language: tag is not well-formed diff --git a/pkg/sql/logictest/testdata/logic_test/computed b/pkg/sql/logictest/testdata/logic_test/computed index 84fa6aba8a2b..d895c5363777 100644 --- a/pkg/sql/logictest/testdata/logic_test/computed +++ b/pkg/sql/logictest/testdata/logic_test/computed @@ -17,8 +17,7 @@ with_no_column_refs CREATE TABLE public.with_no_column_refs ( b INT8 NULL, c INT8 NULL AS (3:::INT8) STORED, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT with_no_column_refs_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, rowid) + CONSTRAINT with_no_column_refs_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -37,8 +36,7 @@ extra_parens CREATE TABLE public.extra_parens ( b INT8 NULL, c INT8 NULL AS (3:::INT8) STORED, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT extra_parens_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, rowid) + CONSTRAINT extra_parens_pkey PRIMARY KEY (rowid ASC) ) @@ -93,8 +91,7 @@ x CREATE TABLE public.x ( c INT8 NULL AS (a) STORED, d INT8 NULL AS (a + b) STORED, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT x_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, d, rowid) + CONSTRAINT x_pkey PRIMARY KEY (rowid ASC) ) query TTBTTTB colnames @@ -721,8 +718,7 @@ x CREATE TABLE public.x ( a INT8 NULL, b INT8 NULL AS (a) STORED, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT x_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, rowid) + CONSTRAINT x_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -746,8 +742,7 @@ x CREATE TABLE public.x ( c INT8 NULL, b INT8 NULL AS (c) STORED, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT x_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (c, b, rowid) + CONSTRAINT x_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -788,8 +783,7 @@ x CREATE TABLE public.x ( b INT8 NULL AS (a * 2:::INT8) STORED, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), c INT8 NOT NULL AS (a + 4:::INT8) STORED, - CONSTRAINT x_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, rowid, c) + CONSTRAINT x_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -922,8 +916,7 @@ t42418 CREATE TABLE public.t42418 ( x INT8 NULL AS (1:::INT8) STORED, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), y INT8 NULL AS (1:::INT8) STORED, - CONSTRAINT t42418_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid, y) + CONSTRAINT t42418_pkey PRIMARY KEY (rowid ASC) ) # Tests for computed column rewrites. @@ -980,8 +973,7 @@ CREATE TABLE public.trewrite_copy ( k INT8 NOT NULL, ts TIMESTAMPTZ NULL, c STRING NULL AS (timezone('utc':::STRING, ts)::STRING) STORED, - CONSTRAINT trewrite_pkey PRIMARY KEY (k ASC), - FAMILY "primary" (k, ts, c) + CONSTRAINT trewrite_pkey PRIMARY KEY (k ASC) ) statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/create_as b/pkg/sql/logictest/testdata/logic_test/create_as index 9f086c78d969..9ace5116b5c8 100644 --- a/pkg/sql/logictest/testdata/logic_test/create_as +++ b/pkg/sql/logictest/testdata/logic_test/create_as @@ -158,8 +158,7 @@ foo5 CREATE TABLE public.foo5 ( a INT8 NULL, b INT8 NOT NULL, c INT8 NULL, - CONSTRAINT foo5_pkey PRIMARY KEY (b ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT foo5_pkey PRIMARY KEY (b ASC) ) statement ok @@ -176,8 +175,7 @@ foo6 CREATE TABLE public.foo6 ( a INT8 NOT NULL, b INT8 NULL, c INT8 NULL, - CONSTRAINT foo6_pkey PRIMARY KEY (a ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT foo6_pkey PRIMARY KEY (a ASC) ) statement error generate insert row: null value in column "x" violates not-null constraint @@ -192,8 +190,7 @@ SHOW CREATE TABLE foo8 foo8 CREATE TABLE public.foo8 ( item STRING NOT NULL, qty INT8 NULL, - CONSTRAINT foo8_pkey PRIMARY KEY (item ASC), - FAMILY "primary" (item, qty) + CONSTRAINT foo8_pkey PRIMARY KEY (item ASC) ) # Allow CREATE TABLE AS to specify composite primary keys. @@ -212,8 +209,7 @@ foo9 CREATE TABLE public.foo9 ( a INT8 NOT NULL, b INT8 NULL, c INT8 NOT NULL, - CONSTRAINT foo9_pkey PRIMARY KEY (a ASC, c ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT foo9_pkey PRIMARY KEY (a ASC, c ASC) ) statement ok @@ -226,8 +222,7 @@ foo10 CREATE TABLE public.foo10 ( a INT8 NOT NULL, b INT8 NOT NULL, c INT8 NOT NULL, - CONSTRAINT foo10_pkey PRIMARY KEY (c ASC, b ASC, a ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT foo10_pkey PRIMARY KEY (c ASC, b ASC, a ASC) ) statement ok @@ -245,8 +240,7 @@ foo11 CREATE TABLE public.foo11 ( x INT8 NOT NULL, y INT8 NULL, z INT8 NOT NULL, - CONSTRAINT foo11_pkey PRIMARY KEY (x ASC, z ASC), - FAMILY "primary" (x, y, z) + CONSTRAINT foo11_pkey PRIMARY KEY (x ASC, z ASC) ) statement error pq: multiple primary keys for table "foo12" are not allowed diff --git a/pkg/sql/logictest/testdata/logic_test/create_index b/pkg/sql/logictest/testdata/logic_test/create_index index 48f4eabde04f..6667244de49d 100644 --- a/pkg/sql/logictest/testdata/logic_test/create_index +++ b/pkg/sql/logictest/testdata/logic_test/create_index @@ -170,8 +170,7 @@ create_index_concurrently_tbl CREATE TABLE public.create_index_concurrently_tbl a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT create_index_concurrently_tbl_pkey PRIMARY KEY (rowid ASC), - INDEX create_index_concurrently_idx (a ASC), - FAMILY "primary" (a, rowid) + INDEX create_index_concurrently_idx (a ASC) ) query T noticetrace @@ -192,8 +191,7 @@ SHOW CREATE TABLE create_index_concurrently_tbl create_index_concurrently_tbl CREATE TABLE public.create_index_concurrently_tbl ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT create_index_concurrently_tbl_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT create_index_concurrently_tbl_pkey PRIMARY KEY (rowid ASC) ) statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/create_statements b/pkg/sql/logictest/testdata/logic_test/create_statements index 17fdb42c0429..c56766fe7fb2 100644 --- a/pkg/sql/logictest/testdata/logic_test/create_statements +++ b/pkg/sql/logictest/testdata/logic_test/create_statements @@ -6512,13 +6512,11 @@ CREATE TABLE public.t ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - CONSTRAINT t_a_fkey FOREIGN KEY (a) REFERENCES public.t(rowid), - FAMILY "primary" (a, rowid) + CONSTRAINT t_a_fkey FOREIGN KEY (a) REFERENCES public.t(rowid) ) CREATE TABLE public.t ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ) {"ALTER TABLE public.t ADD CONSTRAINT t_a_fkey FOREIGN KEY (a) REFERENCES public.t(rowid)"} {"ALTER TABLE public.t VALIDATE CONSTRAINT t_a_fkey"} CREATE TABLE public.v ( "'" INT8 NULL, @@ -6527,15 +6525,13 @@ CREATE TABLE public.v ( CONSTRAINT v_pkey PRIMARY KEY (rowid ASC), CONSTRAINT "v_'_fkey" FOREIGN KEY ("'") REFERENCES public.t(rowid), CONSTRAINT v_s_fkey FOREIGN KEY (s) REFERENCES public.v(s), - UNIQUE INDEX v_s_key (s ASC), - FAMILY "primary" ("'", s, rowid) + UNIQUE INDEX v_s_key (s ASC) ) CREATE TABLE public.v ( "'" INT8 NULL, s STRING NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT v_pkey PRIMARY KEY (rowid ASC), - UNIQUE INDEX v_s_key (s ASC), - FAMILY "primary" ("'", s, rowid) + UNIQUE INDEX v_s_key (s ASC) ) {"ALTER TABLE public.v ADD CONSTRAINT \"v_'_fkey\" FOREIGN KEY (\"'\") REFERENCES public.t(rowid)","ALTER TABLE public.v ADD CONSTRAINT v_s_fkey FOREIGN KEY (s) REFERENCES public.v(s)"} {"ALTER TABLE public.v VALIDATE CONSTRAINT \"v_'_fkey\"","ALTER TABLE public.v VALIDATE CONSTRAINT v_s_fkey"} CREATE TABLE public.c ( a INT8 NOT NULL, @@ -6571,8 +6567,7 @@ SHOW CREATE TABLE unlogged_tbl ---- unlogged_tbl CREATE TABLE public.unlogged_tbl ( col INT8 NOT NULL, - CONSTRAINT unlogged_tbl_pkey PRIMARY KEY (col ASC), - FAMILY "primary" (col) + CONSTRAINT unlogged_tbl_pkey PRIMARY KEY (col ASC) ) statement error pgcode 22023 invalid storage parameter "foo" diff --git a/pkg/sql/logictest/testdata/logic_test/create_table b/pkg/sql/logictest/testdata/logic_test/create_table index 10e80bf84a5c..0b54c4b56a52 100644 --- a/pkg/sql/logictest/testdata/logic_test/create_table +++ b/pkg/sql/logictest/testdata/logic_test/create_table @@ -154,8 +154,7 @@ like_none CREATE TABLE public.like_none ( k INT8 NULL, t TIMESTAMPTZ NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT like_none_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, h, j, k, t, rowid) + CONSTRAINT like_none_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -174,7 +173,6 @@ like_constraints CREATE TABLE public.like_constraints ( t TIMESTAMPTZ NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT like_constraints_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, h, j, k, t, rowid), CONSTRAINT check_a CHECK (a > 3:::INT8), CONSTRAINT unique_k UNIQUE WITHOUT INDEX (k), CONSTRAINT unique_h UNIQUE WITHOUT INDEX (h), @@ -198,8 +196,7 @@ like_indexes CREATE TABLE public.like_indexes ( CONSTRAINT like_table_pkey PRIMARY KEY (a ASC, b ASC), UNIQUE INDEX foo (b DESC, c ASC), INDEX like_table_c_idx (c ASC) STORING (j), - INVERTED INDEX like_table_j_idx (j), - FAMILY "primary" (a, b, c, h, j, k, t) + INVERTED INDEX like_table_j_idx (j) ) # INCLUDING GENERATED adds "generated columns", aka stored columns. @@ -218,8 +215,7 @@ like_generated CREATE TABLE public.like_generated ( k INT8 NULL, t TIMESTAMPTZ NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT like_generated_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, h, j, k, t, rowid) + CONSTRAINT like_generated_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -237,8 +233,7 @@ like_defaults CREATE TABLE public.like_defaults ( k INT8 NULL, t TIMESTAMPTZ NULL DEFAULT current_timestamp():::TIMESTAMPTZ - '00:00:05':::INTERVAL ON UPDATE current_timestamp():::TIMESTAMPTZ, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT like_defaults_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, h, j, k, t, rowid) + CONSTRAINT like_defaults_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -259,7 +254,6 @@ like_all CREATE TABLE public.like_all ( UNIQUE INDEX foo (b DESC, c ASC), INDEX like_table_c_idx (c ASC) STORING (j), INVERTED INDEX like_table_j_idx (j), - FAMILY "primary" (a, b, c, h, j, k, t), CONSTRAINT check_a CHECK (a > 3:::INT8), CONSTRAINT unique_k UNIQUE WITHOUT INDEX (k), CONSTRAINT unique_h UNIQUE WITHOUT INDEX (h), @@ -285,8 +279,7 @@ like_mixed CREATE TABLE public.like_mixed ( CONSTRAINT like_table_pkey PRIMARY KEY (a ASC, b ASC), UNIQUE INDEX foo (b DESC, c ASC), INDEX like_table_c_idx (c ASC) STORING (j), - INVERTED INDEX like_table_j_idx (j), - FAMILY "primary" (a, b, c, h, j, k, t) + INVERTED INDEX like_table_j_idx (j) ) statement ok @@ -304,8 +297,7 @@ like_no_pk_rowid_hidden CREATE TABLE public.like_no_pk_rowid_hidden ( a INT8 NULL, b INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT like_no_pk_table_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, rowid) + CONSTRAINT like_no_pk_table_pkey PRIMARY KEY (rowid ASC) ) statement error duplicate column name @@ -335,8 +327,7 @@ like_more_specifiers CREATE TABLE public.like_more_specifiers ( rowid INT8 NOT VISIBLE NOT NULL, rowid_1 INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT like_more_specifiers_pkey PRIMARY KEY (rowid_1 ASC), - INDEX like_more_specifiers_a_blah_z_idx (a ASC, blah ASC, z ASC), - FAMILY "primary" (a, b, c, h, j, k, t, z, blah, rowid, rowid_1) + INDEX like_more_specifiers_a_blah_z_idx (a ASC, blah ASC, z ASC) ) statement ok @@ -353,8 +344,7 @@ like_hash CREATE TABLE public.like_hash ( crdb_internal_a_shard_4 INT4 NOT VISIBLE NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT like_hash_base_pkey PRIMARY KEY (rowid ASC), - INDEX like_hash_base_a_idx (a ASC) USING HASH WITH (bucket_count=4), - FAMILY "primary" (a, crdb_internal_a_shard_4, rowid) + INDEX like_hash_base_a_idx (a ASC) USING HASH WITH (bucket_count=4) ) statement ok @@ -368,8 +358,7 @@ like_hash CREATE TABLE public.like_hash ( crdb_internal_a_shard_4 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 4:::INT8)) VIRTUAL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT like_hash_base_pkey PRIMARY KEY (rowid ASC), - INDEX like_hash_base_a_idx (a ASC) USING HASH WITH (bucket_count=4), - FAMILY "primary" (a, rowid) + INDEX like_hash_base_a_idx (a ASC) USING HASH WITH (bucket_count=4) ) statement ok @@ -383,8 +372,7 @@ regression_67196_like CREATE TABLE public.regression_67196_like ( pk INT8 NOT NULL, hidden INT8 NOT VISIBLE NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT regression_67196_like_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (pk, hidden, rowid) + CONSTRAINT regression_67196_like_pkey PRIMARY KEY (rowid ASC) ) statement error unimplemented @@ -857,14 +845,13 @@ query T SELECT @2 FROM [SHOW CREATE TABLE t_good_hash_indexes_1]; ---- CREATE TABLE public.t_good_hash_indexes_1 ( - crdb_internal_a_shard_5 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 5:::INT8)) VIRTUAL, - a INT8 NOT NULL, - b INT8 NULL, - c INT8 NULL, - crdb_internal_b_shard_5 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(b)), 5:::INT8)) VIRTUAL, - CONSTRAINT t_good_hash_indexes_1_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=5), - INDEX t_good_hash_indexes_1_b_idx (b ASC) USING HASH WITH (bucket_count=5), - FAMILY "primary" (a, b, c) + crdb_internal_a_shard_5 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 5:::INT8)) VIRTUAL, + a INT8 NOT NULL, + b INT8 NULL, + c INT8 NULL, + crdb_internal_b_shard_5 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(b)), 5:::INT8)) VIRTUAL, + CONSTRAINT t_good_hash_indexes_1_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=5), + INDEX t_good_hash_indexes_1_b_idx (b ASC) USING HASH WITH (bucket_count=5) ) statement ok @@ -877,8 +864,7 @@ query T SELECT @2 FROM [SHOW CREATE TABLE t_good_hash_indexes_2]; ---- CREATE TABLE public.t_good_hash_indexes_2 ( - a INT8 NOT NULL, - crdb_internal_a_shard_5 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 5:::INT8)) VIRTUAL, - CONSTRAINT t_good_hash_indexes_2_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=5), - FAMILY "primary" (a) + a INT8 NOT NULL, + crdb_internal_a_shard_5 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 5:::INT8)) VIRTUAL, + CONSTRAINT t_good_hash_indexes_2_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=5) ) diff --git a/pkg/sql/logictest/testdata/logic_test/delete b/pkg/sql/logictest/testdata/logic_test/delete index d77de50a637d..dc1d5a2db7c5 100644 --- a/pkg/sql/logictest/testdata/logic_test/delete +++ b/pkg/sql/logictest/testdata/logic_test/delete @@ -239,8 +239,7 @@ SELECT create_statement FROM [SHOW CREATE t29494] ---- CREATE TABLE public.t29494 ( x INT8 NOT NULL, - CONSTRAINT t29494_pkey PRIMARY KEY (x ASC), - FAMILY "primary" (x) + CONSTRAINT t29494_pkey PRIMARY KEY (x ASC) ) # Check that the new column is not usable in RETURNING diff --git a/pkg/sql/logictest/testdata/logic_test/drop_index b/pkg/sql/logictest/testdata/logic_test/drop_index index 3d41d285f6af..f7e18659a9b3 100644 --- a/pkg/sql/logictest/testdata/logic_test/drop_index +++ b/pkg/sql/logictest/testdata/logic_test/drop_index @@ -301,8 +301,7 @@ fk1 CREATE TABLE public.fk1 ( rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT fk1_pkey PRIMARY KEY (rowid ASC), CONSTRAINT fk1 FOREIGN KEY (x) REFERENCES public.fk2(x), - INDEX i2 (x ASC), - FAMILY "primary" (x, rowid) + INDEX i2 (x ASC) ) # test that notices are generated on index drops diff --git a/pkg/sql/logictest/testdata/logic_test/drop_sequence b/pkg/sql/logictest/testdata/logic_test/drop_sequence index cea0078cc0a6..bf0a4a15e38f 100644 --- a/pkg/sql/logictest/testdata/logic_test/drop_sequence +++ b/pkg/sql/logictest/testdata/logic_test/drop_sequence @@ -36,8 +36,7 @@ SHOW CREATE TABLE t1 t1 CREATE TABLE public.t1 ( i INT8 NOT NULL DEFAULT nextval('public.drop_test'::REGCLASS), rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t1_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, rowid) + CONSTRAINT t1_pkey PRIMARY KEY (rowid ASC) ) query T @@ -57,8 +56,7 @@ SHOW CREATE TABLE t1 t1 CREATE TABLE public.t1 ( i INT8 NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t1_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, rowid) + CONSTRAINT t1_pkey PRIMARY KEY (rowid ASC) ) query T @@ -222,8 +220,7 @@ SHOW CREATE TABLE t3 t3 CREATE TABLE public.t3 ( i INT8 NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t3_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, rowid) + CONSTRAINT t3_pkey PRIMARY KEY (rowid ASC) ) query T @@ -257,8 +254,7 @@ SHOW CREATE TABLE t4 t4 CREATE TABLE public.t4 ( i INT8 NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t4_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, rowid) + CONSTRAINT t4_pkey PRIMARY KEY (rowid ASC) ) query T @@ -303,8 +299,7 @@ SHOW CREATE TABLE t6 t6 CREATE TABLE public.t6 ( i INT8 NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t6_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, rowid) + CONSTRAINT t6_pkey PRIMARY KEY (rowid ASC) ) query T diff --git a/pkg/sql/logictest/testdata/logic_test/enums b/pkg/sql/logictest/testdata/logic_test/enums index 2b0bd4dba35b..8c85ebbf08b3 100644 --- a/pkg/sql/logictest/testdata/logic_test/enums +++ b/pkg/sql/logictest/testdata/logic_test/enums @@ -375,8 +375,7 @@ t1 CREATE TABLE public.t1 ( x public.greeting NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT t1_pkey PRIMARY KEY (rowid ASC), - INDEX i (x ASC), - FAMILY "primary" (x, rowid) + INDEX i (x ASC) ) # SHOW CREATE uses a virtual index, so also check the code path where a @@ -388,8 +387,7 @@ CREATE TABLE public.t1 ( x public.greeting NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT t1_pkey PRIMARY KEY (rowid ASC), - INDEX i (x ASC), - FAMILY "primary" (x, rowid) + INDEX i (x ASC) ) # Test that the implicit array type has been created, and that we can use it. @@ -585,7 +583,6 @@ enum_checks CREATE TABLE public.enum_checks ( x public.greeting NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT enum_checks_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid), CONSTRAINT check_x CHECK (x = 'hello':::public.greeting), CONSTRAINT "check" CHECK ('hello':::public.greeting = 'hello':::public.greeting) ) diff --git a/pkg/sql/logictest/testdata/logic_test/exclude_data_from_backup b/pkg/sql/logictest/testdata/logic_test/exclude_data_from_backup index a5dc10453884..baf4f52454e5 100644 --- a/pkg/sql/logictest/testdata/logic_test/exclude_data_from_backup +++ b/pkg/sql/logictest/testdata/logic_test/exclude_data_from_backup @@ -13,11 +13,10 @@ ALTER TABLE t SET (exclude_data_from_backup = true); query TT SHOW CREATE TABLE t ---- -t CREATE TABLE public.t ( - x INT8 NOT NULL, - CONSTRAINT t_pkey PRIMARY KEY (x ASC), - FAMILY "primary" (x) - ) WITH (exclude_data_from_backup = true) +t CREATE TABLE public.t ( + x INT8 NOT NULL, + CONSTRAINT t_pkey PRIMARY KEY (x ASC) +) WITH (exclude_data_from_backup = true) statement ok ALTER TABLE t SET (exclude_data_from_backup = false); @@ -25,11 +24,10 @@ ALTER TABLE t SET (exclude_data_from_backup = false); query TT SHOW CREATE TABLE t ---- -t CREATE TABLE public.t ( - x INT8 NOT NULL, - CONSTRAINT t_pkey PRIMARY KEY (x ASC), - FAMILY "primary" (x) - ) +t CREATE TABLE public.t ( + x INT8 NOT NULL, + CONSTRAINT t_pkey PRIMARY KEY (x ASC) +) # Ensure we cannot set schema to a temporary schema. statement ok @@ -56,12 +54,11 @@ query TT SHOW CREATE TABLE t2 ---- t2 CREATE TABLE public.t2 ( - x INT8 NULL, - rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t2_pkey PRIMARY KEY (rowid ASC), - CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t(x) ON DELETE CASCADE, - FAMILY "primary" (x, rowid) - ) WITH (exclude_data_from_backup = true) + x INT8 NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT t2_pkey PRIMARY KEY (rowid ASC), + CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t(x) ON DELETE CASCADE +) WITH (exclude_data_from_backup = true) # Check that we can reset exclude_data_from_backup on a table. statement ok @@ -70,10 +67,9 @@ ALTER TABLE t2 RESET (exclude_data_from_backup); query TT SHOW CREATE TABLE t2 ---- -t2 CREATE TABLE public.t2 ( - x INT8 NULL, - rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t2_pkey PRIMARY KEY (rowid ASC), - CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t(x) ON DELETE CASCADE, - FAMILY "primary" (x, rowid) - ) +t2 CREATE TABLE public.t2 ( + x INT8 NULL, + rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), + CONSTRAINT t2_pkey PRIMARY KEY (rowid ASC), + CONSTRAINT t2_x_fkey FOREIGN KEY (x) REFERENCES public.t(x) ON DELETE CASCADE +) diff --git a/pkg/sql/logictest/testdata/logic_test/expression_index b/pkg/sql/logictest/testdata/logic_test/expression_index index 35ef478d064f..b271a1b86892 100644 --- a/pkg/sql/logictest/testdata/logic_test/expression_index +++ b/pkg/sql/logictest/testdata/logic_test/expression_index @@ -371,8 +371,7 @@ CREATE TABLE public.copy ( j JSONB NULL, comp INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT copy_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (k, a, b, j, comp, rowid) + CONSTRAINT copy_pkey PRIMARY KEY (rowid ASC) ) # Inaccessible expression index columns should not be copied if the indexes are @@ -396,8 +395,7 @@ CREATE TABLE public.copy_generated ( j JSONB NULL, comp INT8 NULL AS (1:::INT8 + 10:::INT8) VIRTUAL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT copy_generated_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (k, a, b, j, rowid) + CONSTRAINT copy_generated_pkey PRIMARY KEY (rowid ASC) ) # Inaccessible expression index columns should not be copied if the indexes are @@ -424,8 +422,7 @@ CREATE TABLE public.copy_indexes ( INDEX src_expr_idx ((a + b) ASC), INDEX named_idx ((a + 1:::INT8) ASC), UNIQUE INDEX src_expr_key ((a + 10:::INT8) ASC), - INVERTED INDEX src_expr_expr1_idx ((a + b), (j->'a':::STRING)), - FAMILY "primary" (k, a, b, j, comp) + INVERTED INDEX src_expr_expr1_idx ((a + b), (j->'a':::STRING)) ) # Inaccessible expression index columns should be copied if the indexes are @@ -452,8 +449,7 @@ CREATE TABLE public.copy_all ( INDEX src_expr_idx ((a + b) ASC), INDEX named_idx ((a + 1:::INT8) ASC), UNIQUE INDEX src_expr_key ((a + 10:::INT8) ASC), - INVERTED INDEX src_expr_expr1_idx ((a + b), (j->'a':::STRING)), - FAMILY "primary" (k, a, b, j) + INVERTED INDEX src_expr_expr1_idx ((a + b), (j->'a':::STRING)) ) # Inaccessible expression index columns should be copied if the indexes are @@ -918,8 +914,7 @@ t72012 CREATE TABLE public.t72012 ( col INT8 NOT NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT t72012_pkey PRIMARY KEY (rowid ASC), - INDEX t72012_idx (abs(col) ASC), - FAMILY "primary" (col, rowid) + INDEX t72012_idx (abs(col) ASC) ) statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/family b/pkg/sql/logictest/testdata/logic_test/family index 43db81ea42af..602a50c654f7 100644 --- a/pkg/sql/logictest/testdata/logic_test/family +++ b/pkg/sql/logictest/testdata/logic_test/family @@ -196,8 +196,7 @@ f1 CREATE TABLE public.f1 ( a INT8 NOT NULL, b STRING NULL, c STRING NULL, - CONSTRAINT f1_pkey PRIMARY KEY (a ASC), - FAMILY "primary" (a, b, c) + CONSTRAINT f1_pkey PRIMARY KEY (a ASC) ) statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/fk b/pkg/sql/logictest/testdata/logic_test/fk index 1bd036ed1bb1..8ace0bff36b9 100644 --- a/pkg/sql/logictest/testdata/logic_test/fk +++ b/pkg/sql/logictest/testdata/logic_test/fk @@ -506,8 +506,7 @@ delivery CREATE TABLE public.delivery ( CONSTRAINT delivery_pkey PRIMARY KEY (rowid ASC), CONSTRAINT delivery_order_shipment_fkey FOREIGN KEY ("order", shipment) REFERENCES public.orders(id, shipment), CONSTRAINT delivery_item_fkey FOREIGN KEY (item) REFERENCES public.products(upc), - INDEX delivery_item_idx (item ASC), - FAMILY "primary" (ts, "order", shipment, item, rowid) + INDEX delivery_item_idx (item ASC) ) statement ok @@ -828,8 +827,7 @@ refpairs CREATE TABLE public.refpairs ( rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT refpairs_pkey PRIMARY KEY (rowid ASC), CONSTRAINT refpairs_a_b_fkey FOREIGN KEY (a, b) REFERENCES public.pairs(src, dest) ON UPDATE RESTRICT, - INDEX refpairs_a_b_c_idx (a ASC, b ASC, c ASC), - FAMILY "primary" (a, b, c, rowid) + INDEX refpairs_a_b_c_idx (a ASC, b ASC, c ASC) ) statement error pgcode 23503 insert on table "refpairs" violates foreign key constraint "refpairs_a_b_fkey"\nDETAIL: Key \(a, b\)=\(100, 'two'\) is not present in table "pairs". @@ -1049,8 +1047,7 @@ refers CREATE TABLE public.refers ( CONSTRAINT refers_pkey PRIMARY KEY (rowid ASC), CONSTRAINT refers_a_fkey FOREIGN KEY (a) REFERENCES public.referee(id), INDEX another_idx (b ASC), - INDEX foo (a ASC), - FAMILY "primary" (a, b, rowid) + INDEX foo (a ASC) ) statement ok @@ -1129,8 +1126,7 @@ SHOW CREATE TABLE pkref_b pkref_b CREATE TABLE public.pkref_b ( b INT8 NOT NULL, CONSTRAINT pkref_b_pkey PRIMARY KEY (b ASC), - CONSTRAINT pkref_b_b_fkey FOREIGN KEY (b) REFERENCES public.pkref_a(a) ON DELETE RESTRICT, - FAMILY "primary" (b) + CONSTRAINT pkref_b_b_fkey FOREIGN KEY (b) REFERENCES public.pkref_a(a) ON DELETE RESTRICT ) subtest 20042 diff --git a/pkg/sql/logictest/testdata/logic_test/geospatial b/pkg/sql/logictest/testdata/logic_test/geospatial index b048c71ec5a6..1ab244316bfa 100644 --- a/pkg/sql/logictest/testdata/logic_test/geospatial +++ b/pkg/sql/logictest/testdata/logic_test/geospatial @@ -77,8 +77,7 @@ SELECT create_statement FROM [SHOW CREATE TABLE geom_table_negative_values] CREATE TABLE public.geom_table_negative_values ( a GEOMETRY(GEOMETRY) NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT geom_table_negative_values_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT geom_table_negative_values_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -92,8 +91,7 @@ SELECT create_statement FROM [SHOW CREATE TABLE geog_table_negative_values] CREATE TABLE public.geog_table_negative_values ( a GEOGRAPHY(GEOMETRY) NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT geog_table_negative_values_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT geog_table_negative_values_pkey PRIMARY KEY (rowid ASC) ) statement error SRID 3857 cannot be used for geography as it is not in a lon/lat coordinate system diff --git a/pkg/sql/logictest/testdata/logic_test/hash_sharded_index b/pkg/sql/logictest/testdata/logic_test/hash_sharded_index index 8c5ce19dffe5..0d33797fea9b 100644 --- a/pkg/sql/logictest/testdata/logic_test/hash_sharded_index +++ b/pkg/sql/logictest/testdata/logic_test/hash_sharded_index @@ -11,8 +11,7 @@ SHOW CREATE TABLE sharded_primary sharded_primary CREATE TABLE public.sharded_primary ( crdb_internal_a_shard_10 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 10:::INT8)) VIRTUAL, a INT8 NOT NULL, - CONSTRAINT sharded_primary_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=10), - FAMILY "primary" (a) + CONSTRAINT sharded_primary_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=10) ) statement error pgcode 22023 BUCKET_COUNT must be a 32-bit integer greater than 1, got -1 @@ -47,8 +46,7 @@ SHOW CREATE TABLE sharded_primary sharded_primary CREATE TABLE public.sharded_primary ( a INT8 NOT NULL, crdb_internal_a_shard_10 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 10:::INT8)) VIRTUAL, - CONSTRAINT "primary" PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=10), - FAMILY "primary" (a) + CONSTRAINT "primary" PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=10) ) query TTT colnames @@ -120,8 +118,7 @@ sharded_secondary CREATE TABLE public.sharded_secondary ( crdb_internal_a_shard_4 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 4:::INT8)) VIRTUAL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT sharded_secondary_pkey PRIMARY KEY (rowid ASC), - INDEX sharded_secondary_a_idx (a ASC) USING HASH WITH (bucket_count=4), - FAMILY "primary" (a, rowid) + INDEX sharded_secondary_a_idx (a ASC) USING HASH WITH (bucket_count=4) ) statement ok @@ -142,8 +139,7 @@ sharded_secondary CREATE TABLE public.sharded_secondary ( crdb_internal_a_shard_4 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 4:::INT8)) VIRTUAL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT sharded_secondary_pkey PRIMARY KEY (rowid ASC), - INDEX sharded_secondary_crdb_internal_a_shard_4_a_idx (a ASC) USING HASH WITH (bucket_count=4), - FAMILY "primary" (a, rowid) + INDEX sharded_secondary_crdb_internal_a_shard_4_a_idx (a ASC) USING HASH WITH (bucket_count=4) ) statement ok @@ -171,8 +167,7 @@ sharded_secondary CREATE TABLE public.sharded_secondary ( rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), crdb_internal_a_shard_10 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 10:::INT8)) VIRTUAL, CONSTRAINT sharded_secondary_pkey PRIMARY KEY (rowid ASC), - INDEX sharded_secondary_a_idx (a ASC) USING HASH WITH (bucket_count=10), - FAMILY "primary" (a, rowid) + INDEX sharded_secondary_a_idx (a ASC) USING HASH WITH (bucket_count=10) ) statement ok @@ -192,8 +187,7 @@ sharded_secondary CREATE TABLE public.sharded_secondary ( crdb_internal_a_shard_4 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 4:::INT8)) VIRTUAL, CONSTRAINT sharded_secondary_pkey PRIMARY KEY (rowid ASC), INDEX sharded_secondary_a_idx (a ASC) USING HASH WITH (bucket_count=10), - INDEX sharded_secondary_a_idx1 (a ASC) USING HASH WITH (bucket_count=4), - FAMILY "primary" (a, rowid) + INDEX sharded_secondary_a_idx1 (a ASC) USING HASH WITH (bucket_count=4) ) # Drop a sharded index and ensure that the shard column is dropped with it. @@ -208,8 +202,7 @@ sharded_secondary CREATE TABLE public.sharded_secondary ( rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), crdb_internal_a_shard_4 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 4:::INT8)) VIRTUAL, CONSTRAINT sharded_secondary_pkey PRIMARY KEY (rowid ASC), - INDEX sharded_secondary_a_idx1 (a ASC) USING HASH WITH (bucket_count=4), - FAMILY "primary" (a, rowid) + INDEX sharded_secondary_a_idx1 (a ASC) USING HASH WITH (bucket_count=4) ) statement ok @@ -222,8 +215,7 @@ SHOW CREATE TABLE sharded_secondary sharded_secondary CREATE TABLE public.sharded_secondary ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT sharded_secondary_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT sharded_secondary_pkey PRIMARY KEY (rowid ASC) ) # Ensure that the shard column cannot be used in the same txn if its dropped along with @@ -269,8 +261,7 @@ sharded_secondary CREATE TABLE public.sharded_secondary ( CONSTRAINT sharded_secondary_pkey PRIMARY KEY (rowid ASC), INDEX sharded_secondary_a_idx (a ASC) USING HASH WITH (bucket_count=10), INDEX sharded_secondary_a_idx1 (a ASC) USING HASH WITH (bucket_count=10), - INDEX sharded_secondary_a_idx2 (a ASC) USING HASH WITH (bucket_count=10), - FAMILY "primary" (a, rowid) + INDEX sharded_secondary_a_idx2 (a ASC) USING HASH WITH (bucket_count=10) ) @@ -291,8 +282,7 @@ sharded_primary CREATE TABLE public.sharded_primary ( crdb_internal_a_shard_10 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 10:::INT8)) VIRTUAL, crdb_internal_a_shard_4 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 4:::INT8)) VIRTUAL, CONSTRAINT "primary" PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=10), - INDEX sharded_primary_a_idx (a ASC) USING HASH WITH (bucket_count=4), - FAMILY "primary" (a) + INDEX sharded_primary_a_idx (a ASC) USING HASH WITH (bucket_count=4) ) statement ok @@ -307,8 +297,7 @@ SHOW CREATE TABLE sharded_primary sharded_primary CREATE TABLE public.sharded_primary ( a INT8 NOT NULL, crdb_internal_a_shard_10 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 10:::INT8)) VIRTUAL, - CONSTRAINT "primary" PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=10), - FAMILY "primary" (a) + CONSTRAINT "primary" PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=10) ) statement ok @@ -321,8 +310,7 @@ sharded_primary CREATE TABLE public.sharded_primary ( a INT8 NOT NULL, crdb_internal_a_shard_10 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 10:::INT8)) VIRTUAL, CONSTRAINT "primary" PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=10), - INDEX sharded_primary_a_idx (a ASC) USING HASH WITH (bucket_count=10), - FAMILY "primary" (a) + INDEX sharded_primary_a_idx (a ASC) USING HASH WITH (bucket_count=10) ) statement ok @@ -401,8 +389,7 @@ column_used_on_unsharded CREATE TABLE public.column_used_on_unsharded ( crdb_internal_a_shard_10 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 10:::INT8)) VIRTUAL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT column_used_on_unsharded_pkey PRIMARY KEY (rowid ASC), - INDEX column_used_on_unsharded_crdb_internal_a_shard_10_idx (crdb_internal_a_shard_10 ASC), - FAMILY "primary" (a, rowid) + INDEX column_used_on_unsharded_crdb_internal_a_shard_10_idx (crdb_internal_a_shard_10 ASC) ) statement ok @@ -426,8 +413,7 @@ column_used_on_unsharded_create_table CREATE TABLE public.column_used_on_unshar crdb_internal_a_shard_10 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 10:::INT8)) VIRTUAL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT column_used_on_unsharded_create_table_pkey PRIMARY KEY (rowid ASC), - INDEX column_used_on_unsharded_create_table_crdb_internal_a_shard_10_idx (crdb_internal_a_shard_10 ASC), - FAMILY "primary" (a, rowid) + INDEX column_used_on_unsharded_create_table_crdb_internal_a_shard_10_idx (crdb_internal_a_shard_10 ASC) ) statement ok @@ -482,8 +468,7 @@ weird_names CREATE TABLE public.weird_names ( "'quotes' in the column's name" INT8 NULL, "crdb_internal_'quotes' in the column's name_shard_4" INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes("'quotes' in the column's name")), 4:::INT8)) VIRTUAL, CONSTRAINT weird_names_pkey PRIMARY KEY ("I am a column with spaces" ASC) USING HASH WITH (bucket_count=12), - INDEX foo ("'quotes' in the column's name" ASC) USING HASH WITH (bucket_count=4), - FAMILY "primary" ("I am a column with spaces", "'quotes' in the column's name") + INDEX foo ("'quotes' in the column's name" ASC) USING HASH WITH (bucket_count=4) ) subtest column_does_not_exist @@ -558,8 +543,7 @@ rename_column CREATE TABLE public.rename_column ( crdb_internal_c0_c1_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(c0, c1)), 8:::INT8)) VIRTUAL, crdb_internal_c2_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(c2)), 8:::INT8)) VIRTUAL, CONSTRAINT rename_column_pkey PRIMARY KEY (c0 ASC, c1 ASC) USING HASH WITH (bucket_count=8), - INDEX rename_column_c2_idx (c2 ASC) USING HASH WITH (bucket_count=8), - FAMILY "primary" (c0, c1, c2) + INDEX rename_column_c2_idx (c2 ASC) USING HASH WITH (bucket_count=8) ) statement ok @@ -582,8 +566,7 @@ rename_column CREATE TABLE public.rename_column ( crdb_internal_c1_c2_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(c1, c2)), 8:::INT8)) VIRTUAL, crdb_internal_c3_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(c3)), 8:::INT8)) VIRTUAL, CONSTRAINT rename_column_pkey PRIMARY KEY (c1 ASC, c2 ASC) USING HASH WITH (bucket_count=8), - INDEX rename_column_c2_idx (c3 ASC) USING HASH WITH (bucket_count=8), - FAMILY "primary" (c1, c2, c3) + INDEX rename_column_c2_idx (c3 ASC) USING HASH WITH (bucket_count=8) ) query III @@ -605,8 +588,7 @@ rename_column CREATE TABLE public.rename_column ( crdb_internal_c0_c1_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(c0, c1)), 8:::INT8)) VIRTUAL, crdb_internal_c2_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(c2)), 8:::INT8)) VIRTUAL, CONSTRAINT rename_column_pkey PRIMARY KEY (c0 ASC, c1 ASC) USING HASH WITH (bucket_count=8), - INDEX rename_column_c2_idx (c2 ASC) USING HASH WITH (bucket_count=8), - FAMILY "primary" (c0, c1, c2) + INDEX rename_column_c2_idx (c2 ASC) USING HASH WITH (bucket_count=8) ) query III @@ -809,10 +791,9 @@ query T SELECT @2 FROM [SHOW CREATE TABLE t] ---- CREATE TABLE public.t ( - crdb_internal_a_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 8:::INT8)) VIRTUAL, - a INT8 NOT NULL, - CONSTRAINT t_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=8), - FAMILY "primary" (a) + crdb_internal_a_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 8:::INT8)) VIRTUAL, + a INT8 NOT NULL, + CONSTRAINT t_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=8) ) # Make sure user defined constraint is used if it's equivalent to the shard @@ -833,11 +814,10 @@ query T SELECT @2 FROM [SHOW CREATE TABLE t] ---- CREATE TABLE public.t ( - crdb_internal_a_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 8:::INT8)) VIRTUAL, - a INT8 NOT NULL, - CONSTRAINT t_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=8), - FAMILY "primary" (a), - CONSTRAINT check_crdb_internal_a_shard_8 CHECK (crdb_internal_a_shard_8 IN (0:::INT8, 1:::INT8, 2:::INT8, 3:::INT8, 4:::INT8, 5:::INT8, 6:::INT8, 7:::INT8)) + crdb_internal_a_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 8:::INT8)) VIRTUAL, + a INT8 NOT NULL, + CONSTRAINT t_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=8), + CONSTRAINT check_crdb_internal_a_shard_8 CHECK (crdb_internal_a_shard_8 IN (0:::INT8, 1:::INT8, 2:::INT8, 3:::INT8, 4:::INT8, 5:::INT8, 6:::INT8, 7:::INT8)) ) subtest test_hash_index_presplit @@ -924,8 +904,7 @@ SELECT @2 FROM [SHOW CREATE TABLE t_default_bucket_8] CREATE TABLE public.t_default_bucket_8 ( crdb_internal_a_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 8:::INT8)) VIRTUAL, a INT8 NOT NULL, - CONSTRAINT t_default_bucket_8_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=8), - FAMILY "primary" (a) + CONSTRAINT t_default_bucket_8_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=8) ) # Make sure that uniqueness is guaranteed with hash index. diff --git a/pkg/sql/logictest/testdata/logic_test/hidden_columns b/pkg/sql/logictest/testdata/logic_test/hidden_columns index 80747391c3b5..4cef58690783 100644 --- a/pkg/sql/logictest/testdata/logic_test/hidden_columns +++ b/pkg/sql/logictest/testdata/logic_test/hidden_columns @@ -29,8 +29,7 @@ SHOW CREATE TABLE t t CREATE TABLE public.t ( x INT8 NOT VISIBLE NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ) # Check that stars expand to no columns. diff --git a/pkg/sql/logictest/testdata/logic_test/insert b/pkg/sql/logictest/testdata/logic_test/insert index 2cc19ea9cf61..acecee54fc93 100644 --- a/pkg/sql/logictest/testdata/logic_test/insert +++ b/pkg/sql/logictest/testdata/logic_test/insert @@ -492,8 +492,7 @@ CREATE TABLE public.sw ( ec STRING COLLATE en NULL, fc STRING(3) COLLATE en NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT sw_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, d, e, f, g, ac, bc, cc, dc, ec, fc, rowid) + CONSTRAINT sw_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -605,8 +604,7 @@ SELECT create_statement FROM [SHOW CREATE t29494] CREATE TABLE public.t29494 ( x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t29494_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t29494_pkey PRIMARY KEY (rowid ASC) ) # Check that the new column is not usable in RETURNING. @@ -646,8 +644,7 @@ CREATE TABLE public.t32759 ( x INT8 NULL, z INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t32759_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, z, rowid) + CONSTRAINT t32759_pkey PRIMARY KEY (rowid ASC) ) # Check that values cannot be inserted into the dropped column. diff --git a/pkg/sql/logictest/testdata/logic_test/int_size b/pkg/sql/logictest/testdata/logic_test/int_size index c925d29cbd95..697ce8146778 100644 --- a/pkg/sql/logictest/testdata/logic_test/int_size +++ b/pkg/sql/logictest/testdata/logic_test/int_size @@ -24,8 +24,7 @@ SHOW CREATE TABLE i4 i4 CREATE TABLE public.i4 ( i4 INT4 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT i4_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i4, rowid) + CONSTRAINT i4_pkey PRIMARY KEY (rowid ASC) ) subtest set_int8 @@ -47,8 +46,7 @@ SHOW CREATE TABLE i8 i8 CREATE TABLE public.i8 ( i8 INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT i8_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i8, rowid) + CONSTRAINT i8_pkey PRIMARY KEY (rowid ASC) ) # https://github.com/cockroachdb/cockroach/issues/32846 @@ -68,8 +66,7 @@ SHOW CREATE TABLE late4 late4 CREATE TABLE public.late4 ( a INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT late4_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT late4_pkey PRIMARY KEY (rowid ASC) ) query T @@ -101,8 +98,7 @@ SHOW CREATE TABLE i4_rowid i4_rowid CREATE TABLE public.i4_rowid ( a INT8 NOT NULL DEFAULT unique_rowid(), rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT i4_rowid_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT i4_rowid_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -117,8 +113,7 @@ SHOW CREATE TABLE i8_rowid i8_rowid CREATE TABLE public.i8_rowid ( a INT8 NOT NULL DEFAULT unique_rowid(), rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT i8_rowid_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT i8_rowid_pkey PRIMARY KEY (rowid ASC) ) subtest serial_sql_sequence @@ -136,8 +131,7 @@ SHOW CREATE TABLE i4_sql_sequence i4_sql_sequence CREATE TABLE public.i4_sql_sequence ( a INT4 NOT NULL DEFAULT nextval('public.i4_sql_sequence_a_seq'::REGCLASS), rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT i4_sql_sequence_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT i4_sql_sequence_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -152,8 +146,7 @@ SHOW CREATE TABLE i8_sql_sequence i8_sql_sequence CREATE TABLE public.i8_sql_sequence ( a INT8 NOT NULL DEFAULT nextval('public.i8_sql_sequence_a_seq'::REGCLASS), rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT i8_sql_sequence_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT i8_sql_sequence_pkey PRIMARY KEY (rowid ASC) ) subtest serial_virtual_sequence @@ -172,8 +165,7 @@ SHOW CREATE TABLE i4_virtual_sequence i4_virtual_sequence CREATE TABLE public.i4_virtual_sequence ( a INT8 NOT NULL DEFAULT nextval('public.i4_virtual_sequence_a_seq'::REGCLASS), rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT i4_virtual_sequence_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT i4_virtual_sequence_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -188,6 +180,5 @@ SHOW CREATE TABLE i8_virtual_sequence i8_virtual_sequence CREATE TABLE public.i8_virtual_sequence ( a INT8 NOT NULL DEFAULT nextval('public.i8_virtual_sequence_a_seq'::REGCLASS), rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT i8_virtual_sequence_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT i8_virtual_sequence_pkey PRIMARY KEY (rowid ASC) ) diff --git a/pkg/sql/logictest/testdata/logic_test/inverted_index b/pkg/sql/logictest/testdata/logic_test/inverted_index index 06a196b334e5..df38d941282a 100644 --- a/pkg/sql/logictest/testdata/logic_test/inverted_index +++ b/pkg/sql/logictest/testdata/logic_test/inverted_index @@ -43,8 +43,7 @@ c CREATE TABLE public.c ( "qUuX" JSONB NULL, CONSTRAINT c_pkey PRIMARY KEY (id ASC), INVERTED INDEX c_foo_idx (foo), - INVERTED INDEX "c_bAr_idx" ("bAr"), - FAMILY "primary" (id, foo, "bAr", "qUuX") + INVERTED INDEX "c_bAr_idx" ("bAr") ) # Regression test for #42944: make sure that mixed-case columns can be @@ -1118,8 +1117,7 @@ c CREATE TABLE public.c ( bar STRING[] NULL, CONSTRAINT c_pkey PRIMARY KEY (id ASC), INVERTED INDEX c_foo_idx (foo), - INVERTED INDEX c_bar_idx (bar), - FAMILY "primary" (id, foo, bar) + INVERTED INDEX c_bar_idx (bar) ) query ITT diff --git a/pkg/sql/logictest/testdata/logic_test/inverted_index_multi_column b/pkg/sql/logictest/testdata/logic_test/inverted_index_multi_column index 4b23a14f93fa..ae1dba10b91e 100644 --- a/pkg/sql/logictest/testdata/logic_test/inverted_index_multi_column +++ b/pkg/sql/logictest/testdata/logic_test/inverted_index_multi_column @@ -105,8 +105,7 @@ CREATE TABLE public.dst ( rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT src_pkey PRIMARY KEY (rowid ASC), INVERTED INDEX src_a_j_idx (a, j), - INVERTED INDEX src_a_b_j_idx (a, b, j), - FAMILY "primary" (a, b, j, rowid) + INVERTED INDEX src_a_b_j_idx (a, b, j) ) # Test dropping a table with a multi-column inverted index. diff --git a/pkg/sql/logictest/testdata/logic_test/name_escapes b/pkg/sql/logictest/testdata/logic_test/name_escapes index 8dee2b76eca0..c48c1dac6adb 100644 --- a/pkg/sql/logictest/testdata/logic_test/name_escapes +++ b/pkg/sql/logictest/testdata/logic_test/name_escapes @@ -67,6 +67,5 @@ SHOW CREATE TABLE ";--dontask" b INT8 NULL, c INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT ";--dontask_pkey" PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, rowid) + CONSTRAINT ";--dontask_pkey" PRIMARY KEY (rowid ASC) ) diff --git a/pkg/sql/logictest/testdata/logic_test/partial_index b/pkg/sql/logictest/testdata/logic_test/partial_index index 9550658cc9f7..368dbe01d70b 100644 --- a/pkg/sql/logictest/testdata/logic_test/partial_index +++ b/pkg/sql/logictest/testdata/logic_test/partial_index @@ -125,8 +125,7 @@ t6 CREATE TABLE public.t6 ( UNIQUE INDEX t6_a_key2 (a DESC) WHERE a > 5:::INT8, INDEX t6i1 (a ASC) WHERE a > 6:::INT8, INDEX t6i2 (a ASC) WHERE a > 7:::INT8, - INDEX t6i3 (a DESC) WHERE a > 8:::INT8, - FAMILY "primary" (a, rowid) + INDEX t6i3 (a DESC) WHERE a > 8:::INT8 ) # Renaming a column updates the index predicates. @@ -149,8 +148,7 @@ t6 CREATE TABLE public.t6 ( UNIQUE INDEX t6_a_key2 (b DESC) WHERE b > 5:::INT8, INDEX t6i1 (b ASC) WHERE b > 6:::INT8, INDEX t6i2 (b ASC) WHERE b > 7:::INT8, - INDEX t6i3 (b DESC) WHERE b > 8:::INT8, - FAMILY "primary" (b, rowid) + INDEX t6i3 (b DESC) WHERE b > 8:::INT8 ) # Renaming a table keeps the index predicates intact. @@ -173,8 +171,7 @@ t7 CREATE TABLE public.t7 ( UNIQUE INDEX t6_a_key2 (b DESC) WHERE b > 5:::INT8, INDEX t6i1 (b ASC) WHERE b > 6:::INT8, INDEX t6i2 (b ASC) WHERE b > 7:::INT8, - INDEX t6i3 (b DESC) WHERE b > 8:::INT8, - FAMILY "primary" (b, rowid) + INDEX t6i3 (b DESC) WHERE b > 8:::INT8 ) # Dropping a column referenced in the predicate drops the index. @@ -221,8 +218,7 @@ t10 CREATE TABLE public.t10 ( b INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT t9_pkey PRIMARY KEY (rowid ASC), - INDEX t9_a_idx (a ASC) WHERE b > 1:::INT8, - FAMILY "primary" (a, b, rowid) + INDEX t9_a_idx (a ASC) WHERE b > 1:::INT8 ) # SHOW CONSTRAINTS includes partial index predicate of UNIQUE partial indexes. diff --git a/pkg/sql/logictest/testdata/logic_test/partial_txn_commit b/pkg/sql/logictest/testdata/logic_test/partial_txn_commit index 363df6a1fd94..628487e6f7fd 100644 --- a/pkg/sql/logictest/testdata/logic_test/partial_txn_commit +++ b/pkg/sql/logictest/testdata/logic_test/partial_txn_commit @@ -33,6 +33,5 @@ SHOW CREATE t t CREATE TABLE public.t ( x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ) diff --git a/pkg/sql/logictest/testdata/logic_test/rename_constraint b/pkg/sql/logictest/testdata/logic_test/rename_constraint index 99acdef07ea7..26fa075b4574 100644 --- a/pkg/sql/logictest/testdata/logic_test/rename_constraint +++ b/pkg/sql/logictest/testdata/logic_test/rename_constraint @@ -17,7 +17,6 @@ CREATE TABLE public.t ( CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), CONSTRAINT cf FOREIGN KEY (x) REFERENCES public.t(x), UNIQUE INDEX cu (x ASC), - FAMILY "primary" (x, y, rowid), CONSTRAINT cc CHECK (x > 10:::INT8) ) @@ -45,7 +44,6 @@ CREATE TABLE public.t ( CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), CONSTRAINT cf2 FOREIGN KEY (x) REFERENCES public.t(x), UNIQUE INDEX cu2 (x ASC), - FAMILY "primary" (x, y, rowid), CONSTRAINT cc2 CHECK (x > 10:::INT8) ) @@ -97,7 +95,6 @@ CREATE TABLE public.t ( CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), CONSTRAINT cf4 FOREIGN KEY (x) REFERENCES public.t(x), UNIQUE INDEX cu4 (x ASC), - FAMILY "primary" (x, y, rowid), CONSTRAINT cc4 CHECK (x > 10:::INT8) ) diff --git a/pkg/sql/logictest/testdata/logic_test/schema_change_in_txn b/pkg/sql/logictest/testdata/logic_test/schema_change_in_txn index 9aa1daf613e6..b1b98a41992d 100644 --- a/pkg/sql/logictest/testdata/logic_test/schema_change_in_txn +++ b/pkg/sql/logictest/testdata/logic_test/schema_change_in_txn @@ -282,8 +282,7 @@ b CREATE TABLE public.b ( CONSTRAINT b_pkey PRIMARY KEY (rowid ASC), CONSTRAINT b_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.parent(id), INDEX foo (parent_id ASC), - UNIQUE INDEX bar (parent_id ASC), - FAMILY "primary" (parent_id, rowid, d) + UNIQUE INDEX bar (parent_id ASC) ) # table b is not visible to the transaction #17949 diff --git a/pkg/sql/logictest/testdata/logic_test/sequences_regclass b/pkg/sql/logictest/testdata/logic_test/sequences_regclass index d2ac96990ee4..2d7704f74a6f 100644 --- a/pkg/sql/logictest/testdata/logic_test/sequences_regclass +++ b/pkg/sql/logictest/testdata/logic_test/sequences_regclass @@ -48,8 +48,7 @@ foo CREATE TABLE public.foo ( j INT8 NOT NULL DEFAULT nextval('public.test_seq'::REGCLASS), k INT8 NOT NULL DEFAULT nextval('public.foo_k_seq'::REGCLASS), l INT8 NOT NULL DEFAULT currval('diff_db.public.test_seq'::REGCLASS), - CONSTRAINT foo_pkey PRIMARY KEY (i ASC), - FAMILY "primary" (i, j, k, l) + CONSTRAINT foo_pkey PRIMARY KEY (i ASC) ) statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/serial b/pkg/sql/logictest/testdata/logic_test/serial index e6fa85b19c79..151dbb9c7015 100644 --- a/pkg/sql/logictest/testdata/logic_test/serial +++ b/pkg/sql/logictest/testdata/logic_test/serial @@ -17,8 +17,7 @@ serial CREATE TABLE public.serial ( b INT8 NULL DEFAULT 7:::INT8, c INT8 NOT NULL DEFAULT unique_rowid(), CONSTRAINT serial_pkey PRIMARY KEY (a ASC), - UNIQUE INDEX serial_c_key (c ASC), - FAMILY "primary" (a, b, c) + UNIQUE INDEX serial_c_key (c ASC) ) statement ok @@ -55,8 +54,7 @@ smallbig CREATE TABLE public.smallbig ( b INT8 NOT NULL DEFAULT unique_rowid(), c INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT smallbig_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, rowid) + CONSTRAINT smallbig_pkey PRIMARY KEY (rowid ASC) ) query III @@ -79,8 +77,7 @@ serials CREATE TABLE public.serials ( c INT8 NOT NULL DEFAULT unique_rowid(), d INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT serials_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, d, rowid) + CONSTRAINT serials_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -121,8 +118,7 @@ serial CREATE TABLE public.serial ( b INT8 NULL DEFAULT 7:::INT8, c INT8 NOT NULL DEFAULT nextval('public.serial_c_seq2'::REGCLASS), CONSTRAINT serial_pkey PRIMARY KEY (a ASC), - UNIQUE INDEX serial_c_key (c ASC), - FAMILY "primary" (a, b, c) + UNIQUE INDEX serial_c_key (c ASC) ) query TT @@ -164,8 +160,7 @@ smallbig CREATE TABLE public.smallbig ( b INT8 NOT NULL DEFAULT nextval('public.smallbig_b_seq'::REGCLASS), c INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT smallbig_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, rowid) + CONSTRAINT smallbig_pkey PRIMARY KEY (rowid ASC) ) query III @@ -188,8 +183,7 @@ serials CREATE TABLE public.serials ( c INT8 NOT NULL DEFAULT nextval('public.serials_c_seq'::REGCLASS), d INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT serials_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, d, rowid) + CONSTRAINT serials_pkey PRIMARY KEY (rowid ASC) ) statement ok @@ -226,8 +220,7 @@ serial CREATE TABLE public.serial ( b INT8 NULL DEFAULT 7:::INT8, c INT8 NOT NULL DEFAULT nextval('public.serial_c_seq2'::REGCLASS), CONSTRAINT serial_pkey PRIMARY KEY (a ASC), - UNIQUE INDEX serial_c_key (c ASC), - FAMILY "primary" (a, b, c) + UNIQUE INDEX serial_c_key (c ASC) ) query TT @@ -282,8 +275,7 @@ SHOW CREATE TABLE "serial_MixedCase" b INT8 NULL DEFAULT 7:::INT8, c INT8 NOT NULL DEFAULT nextval('public."serial_MixedCase_c_seq"'::REGCLASS), CONSTRAINT "serial_MixedCase_pkey" PRIMARY KEY (a ASC), - UNIQUE INDEX "serial_MixedCase_c_key" (c ASC), - FAMILY "primary" (a, b, c) + UNIQUE INDEX "serial_MixedCase_c_key" (c ASC) ) statement error multiple default values specified for column "a" of table "s1" @@ -309,8 +301,7 @@ smallbig CREATE TABLE public.smallbig ( b INT8 NOT NULL DEFAULT nextval('public.smallbig_b_seq'::REGCLASS), c INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT smallbig_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, rowid) + CONSTRAINT smallbig_pkey PRIMARY KEY (rowid ASC) ) query III @@ -333,8 +324,7 @@ serials CREATE TABLE public.serials ( c INT8 NOT NULL DEFAULT nextval('public.serials_c_seq'::REGCLASS), d INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT serials_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, b, c, d, rowid) + CONSTRAINT serials_pkey PRIMARY KEY (rowid ASC) ) statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/show_create_all_tables b/pkg/sql/logictest/testdata/logic_test/show_create_all_tables index a22f131bac8a..7206f92a35ee 100644 --- a/pkg/sql/logictest/testdata/logic_test/show_create_all_tables +++ b/pkg/sql/logictest/testdata/logic_test/show_create_all_tables @@ -172,19 +172,16 @@ SHOW CREATE ALL TABLES create_statement CREATE TABLE public.b ( i INT8 NOT NULL, - CONSTRAINT b_pkey PRIMARY KEY (i ASC), - FAMILY "primary" (i) + CONSTRAINT b_pkey PRIMARY KEY (i ASC) ); CREATE TABLE public.a ( i INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT a_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, rowid) + CONSTRAINT a_pkey PRIMARY KEY (rowid ASC) ); CREATE TABLE public.g ( i INT8 NOT NULL, - CONSTRAINT g_pkey PRIMARY KEY (i ASC), - FAMILY "primary" (i) + CONSTRAINT g_pkey PRIMARY KEY (i ASC) ); CREATE TABLE public.f ( i INT8 NOT NULL, @@ -194,8 +191,7 @@ CREATE TABLE public.f ( ); CREATE TABLE public.e ( i INT8 NOT NULL, - CONSTRAINT e_pkey PRIMARY KEY (i ASC), - FAMILY "primary" (i) + CONSTRAINT e_pkey PRIMARY KEY (i ASC) ); CREATE TABLE public.d ( i INT8 NOT NULL, @@ -207,8 +203,7 @@ CREATE TABLE public.d ( CREATE TABLE public.c ( i INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT c_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, rowid) + CONSTRAINT c_pkey PRIMARY KEY (rowid ASC) ); CREATE SEQUENCE public.s MINVALUE 1 MAXVALUE 9223372036854775807 INCREMENT 1 START 1; CREATE TABLE public.s_tbl ( @@ -285,8 +280,7 @@ SHOW CREATE ALL TABLES create_statement CREATE TABLE public.t ( i INT8 NOT NULL, - CONSTRAINT pk_name PRIMARY KEY (i ASC), - FAMILY "primary" (i) + CONSTRAINT pk_name PRIMARY KEY (i ASC) ); # Test that computed columns are shown correctly. @@ -326,8 +320,7 @@ CREATE TABLE public.";" ( ";" INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT ";_pkey" PRIMARY KEY (rowid ASC), - INDEX ";_;_idx" (";" ASC), - FAMILY "primary" (";", rowid) + INDEX ";_;_idx" (";" ASC) ); # Ensure quotes in comments are properly escaped, also that the object names @@ -346,8 +339,7 @@ SHOW CREATE ALL TABLES create_statement CREATE TABLE public."t t" ( "x'" INT8 NOT NULL, - CONSTRAINT "t t_pkey" PRIMARY KEY ("x'" ASC), - FAMILY "primary" ("x'") + CONSTRAINT "t t_pkey" PRIMARY KEY ("x'" ASC) ); COMMENT ON TABLE public."t t" IS e'has \' quotes'; COMMENT ON COLUMN public."t t"."x'" IS e'i \' just \' love \' quotes'; @@ -369,14 +361,12 @@ create_statement CREATE TABLE sc1.t ( x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ); CREATE TABLE sc2.t ( x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ); # Ensure sequences are shown correctly. @@ -405,8 +395,7 @@ create_statement CREATE TABLE public.t ( x public.test NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ); # Test with column families. diff --git a/pkg/sql/logictest/testdata/logic_test/show_create_all_tables_builtin b/pkg/sql/logictest/testdata/logic_test/show_create_all_tables_builtin index f622b805614a..f9978c2ce40f 100644 --- a/pkg/sql/logictest/testdata/logic_test/show_create_all_tables_builtin +++ b/pkg/sql/logictest/testdata/logic_test/show_create_all_tables_builtin @@ -167,19 +167,16 @@ SELECT crdb_internal.show_create_all_tables('test_fk_order') ---- CREATE TABLE public.b ( i INT8 NOT NULL, - CONSTRAINT b_pkey PRIMARY KEY (i ASC), - FAMILY "primary" (i) + CONSTRAINT b_pkey PRIMARY KEY (i ASC) ); CREATE TABLE public.a ( i INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT a_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, rowid) + CONSTRAINT a_pkey PRIMARY KEY (rowid ASC) ); CREATE TABLE public.g ( i INT8 NOT NULL, - CONSTRAINT g_pkey PRIMARY KEY (i ASC), - FAMILY "primary" (i) + CONSTRAINT g_pkey PRIMARY KEY (i ASC) ); CREATE TABLE public.f ( i INT8 NOT NULL, @@ -189,8 +186,7 @@ CREATE TABLE public.f ( ); CREATE TABLE public.e ( i INT8 NOT NULL, - CONSTRAINT e_pkey PRIMARY KEY (i ASC), - FAMILY "primary" (i) + CONSTRAINT e_pkey PRIMARY KEY (i ASC) ); CREATE TABLE public.d ( i INT8 NOT NULL, @@ -202,8 +198,7 @@ CREATE TABLE public.d ( CREATE TABLE public.c ( i INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT c_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (i, rowid) + CONSTRAINT c_pkey PRIMARY KEY (rowid ASC) ); CREATE SEQUENCE public.s MINVALUE 1 MAXVALUE 9223372036854775807 INCREMENT 1 START 1; CREATE TABLE public.s_tbl ( @@ -276,9 +271,8 @@ query T SELECT crdb_internal.show_create_all_tables('test_primary_key') ---- CREATE TABLE public.t ( - i INT8 NOT NULL, - CONSTRAINT pk_name PRIMARY KEY (i ASC), - FAMILY "primary" (i) + i INT8 NOT NULL, + CONSTRAINT pk_name PRIMARY KEY (i ASC) ); # Test that computed columns are shown correctly. @@ -314,8 +308,7 @@ CREATE TABLE public.";" ( ";" INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT ";_pkey" PRIMARY KEY (rowid ASC), - INDEX ";_;_idx" (";" ASC), - FAMILY "primary" (";", rowid) + INDEX ";_;_idx" (";" ASC) ); # Ensure quotes in comments are properly escaped, also that the object names @@ -332,8 +325,7 @@ SELECT crdb_internal.show_create_all_tables('test_comment') ---- CREATE TABLE public."t t" ( "x'" INT8 NOT NULL, - CONSTRAINT "t t_pkey" PRIMARY KEY ("x'" ASC), - FAMILY "primary" ("x'") + CONSTRAINT "t t_pkey" PRIMARY KEY ("x'" ASC) ); COMMENT ON TABLE public."t t" IS e'has \' quotes'; COMMENT ON COLUMN public."t t"."x'" IS e'i \' just \' love \' quotes'; @@ -354,14 +346,12 @@ SELECT crdb_internal.show_create_all_tables('test_schema') CREATE TABLE sc1.t ( x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ); CREATE TABLE sc2.t ( x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ); # Ensure sequences are shown correctly. @@ -388,14 +378,12 @@ COMMIT; CREATE TABLE sc1.t ( x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ); CREATE TABLE sc2.t ( x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ); query T @@ -407,12 +395,10 @@ COMMIT; CREATE TABLE sc1.t ( x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ); CREATE TABLE sc2.t ( x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t_pkey PRIMARY KEY (rowid ASC) ); diff --git a/pkg/sql/logictest/testdata/logic_test/table b/pkg/sql/logictest/testdata/logic_test/table index 86788224324a..54aa6746ac7b 100644 --- a/pkg/sql/logictest/testdata/logic_test/table +++ b/pkg/sql/logictest/testdata/logic_test/table @@ -499,8 +499,7 @@ SHOW CREATE TABLE test.null_default test.public.null_default CREATE TABLE public.null_default ( ts TIMESTAMP NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT null_default_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (ts, rowid) + CONSTRAINT null_default_pkey PRIMARY KEY (rowid ASC) ) # Issue #13873: don't permit invalid default columns diff --git a/pkg/sql/logictest/testdata/logic_test/update b/pkg/sql/logictest/testdata/logic_test/update index 5191f8962807..1e2fcebebc63 100644 --- a/pkg/sql/logictest/testdata/logic_test/update +++ b/pkg/sql/logictest/testdata/logic_test/update @@ -481,8 +481,7 @@ SELECT create_statement FROM [SHOW CREATE t29494] ---- CREATE TABLE public.t29494 ( x INT8 NOT NULL, - CONSTRAINT t29494_pkey PRIMARY KEY (x ASC), - FAMILY "primary" (x) + CONSTRAINT t29494_pkey PRIMARY KEY (x ASC) ) # Check that the new column is not usable in RETURNING diff --git a/pkg/sql/logictest/testdata/logic_test/upsert b/pkg/sql/logictest/testdata/logic_test/upsert index cbb48a5f57b4..8de929c5cdee 100644 --- a/pkg/sql/logictest/testdata/logic_test/upsert +++ b/pkg/sql/logictest/testdata/logic_test/upsert @@ -636,8 +636,7 @@ SELECT create_statement FROM [SHOW CREATE t29494] CREATE TABLE public.t29494 ( x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t29494_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (x, rowid) + CONSTRAINT t29494_pkey PRIMARY KEY (rowid ASC) ) # Check that the new column is not usable in RETURNING diff --git a/pkg/sql/logictest/testdata/logic_test/virtual_columns b/pkg/sql/logictest/testdata/logic_test/virtual_columns index 5f1faf1f18c1..b26e95f4343c 100644 --- a/pkg/sql/logictest/testdata/logic_test/virtual_columns +++ b/pkg/sql/logictest/testdata/logic_test/virtual_columns @@ -1182,8 +1182,7 @@ CREATE TABLE public.t63167_b ( a INT8 NULL, v INT8 NULL AS (a + 1:::INT8) VIRTUAL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT t63167_a_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (a, rowid) + CONSTRAINT t63167_a_pkey PRIMARY KEY (rowid ASC) ) # Test that columns backfills to tables with virtual columns work. diff --git a/pkg/sql/logictest/testdata/logic_test/zone_config b/pkg/sql/logictest/testdata/logic_test/zone_config index aa08d3714ff2..f083ec7c91ab 100644 --- a/pkg/sql/logictest/testdata/logic_test/zone_config +++ b/pkg/sql/logictest/testdata/logic_test/zone_config @@ -167,8 +167,7 @@ SHOW CREATE TABLE a ---- a CREATE TABLE public.a ( id INT8 NOT NULL, - CONSTRAINT a_pkey PRIMARY KEY (id ASC), - FAMILY "primary" (id) + CONSTRAINT a_pkey PRIMARY KEY (id ASC) ); ALTER TABLE test.public.a CONFIGURE ZONE USING range_min_bytes = 200001, @@ -322,8 +321,7 @@ SHOW CREATE TABLE same_table_name ---- same_table_name CREATE TABLE public.same_table_name ( rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT same_table_name_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (rowid) + CONSTRAINT same_table_name_pkey PRIMARY KEY (rowid ASC) ); ALTER TABLE test.public.same_table_name CONFIGURE ZONE USING gc.ttlseconds = 500 @@ -333,8 +331,7 @@ SHOW CREATE TABLE alternative_schema.same_table_name ---- alternative_schema.same_table_name CREATE TABLE alternative_schema.same_table_name ( rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), - CONSTRAINT same_table_name_pkey PRIMARY KEY (rowid ASC), - FAMILY "primary" (rowid) + CONSTRAINT same_table_name_pkey PRIMARY KEY (rowid ASC) ); ALTER TABLE test.alternative_schema.same_table_name CONFIGURE ZONE USING gc.ttlseconds = 600 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/explain_env b/pkg/sql/opt/exec/execbuilder/testdata/explain_env index cc628b2d8ff8..1aea7a134929 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/explain_env +++ b/pkg/sql/opt/exec/execbuilder/testdata/explain_env @@ -37,7 +37,7 @@ CREATE TABLE y ( query T EXPLAIN (OPT, ENV) SELECT * FROM x WHERE b = 3 ---- -https://cockroachdb.github.io/text/decode.html#eJy0lNFu6jYYx6_rp_iUmwMTGQncVEFHWg4n1bLRUEHWtaoqy0kMeBg7cxwITJP6EDxhn2RyQls2iaJqKhdI_vL_ff77-zuxbbilqmBSeDCU6VJJki6-fwNa0TQpGc-oAk0LDetGhZBtg6JSZVThPyQTBeZsxTQsSAF6QSGjM1JyDWvCS-rBpdFTQRJO8Y7Nd2ReU6fkUhi9zDVbsR1VuCwoXrBCy7kiq-Ij1KrkmqWS40ITfYbkMiWc6S1-aZHhnCjNNJOCZpiJjFa4SMkZ27mSOZkTTTETealxPSQm5iep2azB6IwqzKVclvlhpjOp8Gx52nZDMqGpWhNe6C2nuJlydobJiInzA3pWEM7lBs9KzrGugzSjOOeNEzWnDWTkWMnNScR1HMcwqSx00xxvmF7ggwzXMbIdfW_LaRAbr7r4k8NXUxkAGPv_VpJSS7PTmqZaqvdaCoSGk8CPA4j9b6MA8jLhLP2xgha6IBBG8SVE4xii30ajDrpIDpVmNRxH03jih1EMFc6XdAs3k_Dan9zDr8E9tAj402G7gy7C6HtwBxVOMMsqaCUv9Sv_Ohzdg5UrtiJqa0GLdCBpo_YAIX8UB5P_egqjX4JhDNPYj8NpHA6n8OUBAQD8Vf-bn0XW83qIlgdO562cSl6uRGF58PBabPTW6_rxWK8o0TTDRFseWD3HvbQd13ZccFzPcTzHsY7EJhAmUpNgKQzgOsd71292na7e5saYdQwLc3dewGNMyc1bw17f7fXrZ393_u-Rk085cu3w806NHr8MEArubkZ-GEFrfBN3IIhu2zANRuZS_ABXk_E1VPD7z8EkgAS-Qn-AbNu2Uf1Jq346XEAEz_v98_7pef8EqRSFVoQJ7UG313U9eOj2wYZu_xH9EwAA___co-HC +https://cockroachdb.github.io/text/decode.html#eJy0lNFu8jYUx6_rpzjKzUcnMhK4qYIqLaWZlo2GCrKuVVVZTmLAw9iZ40BgmtSH4An7JJMT2rJJFFWfygWST_6_c_4-5yS2DXdUFUwKDwYyXShJ0vn1FdCKpknJeEYVaFpoWDUqhGwbFJUqowr_KZkoMGdLpmFOCtBzChmdkpJrWBFeUg8ujJ4KknCKt2y2JbOaOiaXwuhlrtmSbanCZUHxnBVazhRZFp-hliXXLJUcF5roEySXKeFMb_BrigznRGmmmRQ0w0xktMJFSk7YzpXMyYxoipnIS43rJjExO0pNpw1Gp1RhLuWizPc9nUqFp4vjthuSCU3VivBCbzjFTZezE0xGzDg_oWcF4Vyu8bTkHOt6kKYVp7xxoma0gYwcK7k-iriO4xgmlYVukuM103O8l-F6jGxLPyo5CWLjVRd_cbg0kT6Asf9fJSm1NJVWNNVSfZRSIDQYB34cQOxfDQPIy4Sz9McKWuiMQBjFFxCNYoh-Hw7b6CzZR5rTYBRN4rEfRjFUOF_QDdyOwxt__AC_BQ_QIuBPBudtdBZG18E9VDjBLKugldRxdN5HyB_Gwfj_lcPo12AQwyT243ASh4MJfHtEAAB_1__mZ5HVrG6V5YHTfg-nkpdLUVgePL4FG731dn461CtKNM0w0ZYHVtdxL2zHtR0XHNdzHM9xrAOxaTsTqZlTKQzgOoe16_e3nqHe5MaYdQgLsyGv4CGm5Po9Ybfndnv1s3_a33vl5EuuXDv8ulujp299hIL726EfRtAa3cZtCKK7c5gEQ7MUP8DP49ENVPDHL8E4gAQuoddHtm3bqP5wVT_t1wzBy273snt-2T1DKkWhFWFCe9DpdlwPHjs9sKHTe0L_BgAA__-x9NrZ statement error ENV only supported with \(OPT\) option EXPLAIN (ENV) SELECT * FROM x WHERE b = 3 @@ -49,7 +49,7 @@ EXPLAIN (ENV) SELECT * FROM x WHERE b = 3 query T EXPLAIN (OPT, ENV) SELECT * FROM x, y WHERE b = 3 ---- -https://cockroachdb.github.io/text/decode.html#eJy0ldFu2zYUhq-rpzjQTe3BWuT4JlBQYKrLbNocOZC1rkEQEJRE2VxoUiMpxcowoNgz-HJPlycZKDmJu8YNiqG-MKCj7yd_nvPT9jx4T5VmUgQwlfmNkiRfvXsLdEPzrGa8oAoM1QaannIczwNFpSqowr9LJjTmbM0MrIgGs6JQ0JLU3EBDeE0DOLE8FSTjFN-x5R1ZdqpDuBSWl5Vha3ZHFa41xSumjVwqstZfo1rX3LBccqwNMS8oucwJZ6bFD0sUuCLKMMOkoAVmoqAbrHPygu1KyYosiaGYiao2uGsSE8uDqrLsZbSkCnMpb-pq19NSKlzeHLbdK5kwVDWEa9NyivsuFy9oCmLH-RU804RzeYvLmnNsukHaVrzkjRO1pL3I4ljJ24OSse_7VpNLbfrF8S0zK7zDcDdGdke_tOUCpdar0X9weGMrpwDW_qckqY20OzU0N1J9aUnhONMEhSmCNHw7Q1DVGWf59xsYOK8IRHF6AvE8hfjX2WzkvMp2lf5pOo8XaRJGcQobXN3QFi6S6DxMLuEXdAkDAuFiOhw5r6L4HfoAG5xhVmxgkD3Uz8LzaHYJbqXYmqjWhQEZQTZ0hqeOE85SlPzXUxT_jKYpLNIwjRZpNF3A6ysHAODP7tt-XNIsuya6Afijp3Iueb0W2g3g6rHY8-7j8_U-rygxtMDEuAG4x_74xPPHnj8Gfxz4fuD77h5sB8JEbidYCysY-_t7dze7m65pK2vM3RcLm50H4b5MydunBY8n4-NJ9-6v0f89cvZNjtw5_Handq5fnz6f1dZmtf4sq82hrLbPZLV-yOQnXINLS57NExT9GPdkM4QEnaEExVO0eIzmgDwF3eq6oDeHg16PoDkY9PbZoHfnRx8uZmEUw2B-kY4Axe-HsEAzy34HZ8n8HDYjaOG3n1CCIIM3MDl1PM_zHCYEVV73lzTIldR66MD99p_77cf77UfofvPbzyqbH3Z31r75207hfrvdAbkU2ijChAng6PhoHMDV0QQ8OJpcO3tYybihSsPAqJoOnX8DAAD__3W7TB0= +https://cockroachdb.github.io/text/decode.html#eJy0ld9u2zYUxq_DpzjwTe3BWuT4JlBQYK7LbNpcOZC1rkUQELRE2VxoUiMpRcowoNgz-HJPlycZKDmJu8YJiqG-MKCj38fz76PtefCeacOVDGCq0mutaLp--wZYzdJlyUXGNFhmLFQdhZDngWZKZ0yT3xWXhgi-4RbW1IBdM8hYTkthoaKiZAGcOp5JuhSM3PLVLV21qkO4ko5XheUbfss0KQ0ja26sWmm6MV-j2pTC8lQJYiy1LyiFSqngtiH3R2SkoNpyy5VkGeEyYzUxKX2h7EKrgq6oZYTLorSkHRKXq4OqPO9kLGeaCKWuy2I301xpkl8fLrtTcmmZrqgwthGMdFPOXtBk1K3zK3huqBDqhuSlEMS2i3SjeKk2QfWKdSKHE61uDkpGvu87TaqM7Q4nN9yuyQ4j7Rr5LXsu5QInrlZr_hDw2kXOAFz5n5O0tMplqlhqlX7uSInQNMaTBEMyeTPDUJRLwdPva-ijIwphlJxCNE8g-nU2G6Kj5S7SPU3n0SKJJ2GUQE2Ka9bARRy-m8Qf4Rf8EfoUJovpYIiOwugt_gA1WRKe1dBftnE0OENoMktw_N_MYfQzniawSCZJuEjC6QJeXSIAgD_bb_fp0WrVjqoXgD98DKdKlBtpegFcPgQ7vvfwfLXPa0Ytywi1vQB6J_7o1PNHnj8CfxT4fuD7vT3YjZ3L1O2plE4w8vdzt_e33aFtCldYb18snUPuhfsyrW4eDzwZj07G7bu_hv-35eU3abmt8Nt1ja5enT3tyMY5svzCkdUhRzZPOLK8d-RnXEVyR57PYxz-GHVkNYAYn-MYR1O8eLBmnz7a2elaO1fP2rl50s5tl_jDxWwSRtCfXyRDwNH7ASzwzLHfwXk8fwf1EBr47SccY1jCaxifIc_zPMSlZNpr_176qVbGDBDcbf-52366236C9ve7-SJS_7C7f-7N327Wd9vtDkiVNFZTLm0AxyfHowAuj8fgwfH4Cu1hOReWaQN9q0s2QP8GAAD__wMoPiM= # # Same table twice should only show up once. @@ -58,7 +58,7 @@ https://cockroachdb.github.io/text/decode.html#eJy0ldFu2zYUhq-rpzjQTe3BWuT4JlBQY query T EXPLAIN (OPT, ENV) SELECT * FROM x one, x two ---- -https://cockroachdb.github.io/text/decode.html#eJy0lFFv2zYQx5_DT3HQS-3BGuT0JXDQB9VVAW2OElha0SAICEo62VxoUiMpW_YwoB_Cj_t0-SQDJaf1BrhGMcQPhnn3_x3_vKPp-_AJteFKTmCqiietWLH88B6wxSJvuChRg0VjYd2rCPF90Kh0iZr-rrg0VPAVt7BkBuwSocSKNcLCmokGJ3Dl9ChZLpDu-GLHFh11Sq6k06va8hXfoaaNQbrkxqqFZivzI9SqEZYXSlBjmT1DClUwwe2WvpQoac205ZYriSXlssSWmoKdsV1rVbMFs0i5rBtLuyZxuThJVVWPYYWaCqWemvrQ00ppWj2dtt2TXFrUayaM3QqkfZfLM0zJ3Dh_QM8NE0JtaNUIQW03SNeKc94E0wvsISenWm1OIuMgCBxTKGP74nTD7ZIeZLQbI9_h97ZMo8x5teYPAe9c5BrA2f-3kjVWuZ3WWFilv1dSEjKdR2EWQRa-n0VQN7ngxc8tDMgFgzjJriC5zSD5bTYbkYv8EOlX09skzeZhnGTQ0voJt3A3j2_C-T38Gt3DgEGYTocjchEnH6LP0NKc8rKFQf4S_xjexLN78GrNV0xvPRiwEeRDMrwmJJxl0fy_nuLkl2iaQZqFWZxm8TSFNw8EAODP7tt9PLZedE30JhCMvoULJZqVNN4EHr4Ge733df14rNfILJaUWW8C3mUwvvKDsR-MIRhPgmASBN6R2A2Ey8JNsJEOGAfHe3f_7G66dls7Y94xLN3deQGPMa023wpevh1fvu1yf43-75HzVzly5_D1Tk0e31wTEn2-m4VxAoPbu2wEUfJpCGk0c5fiJ_g4v72BFsIUlMRR_8tu1DXxfd8nXErUfvcoDwqtjBkSeN7__bz_8rz_At2r18IDM--UxMcTKbtRXWp_SFVcWNQGBlY3OCT_BAAA___pUfo2 +https://cockroachdb.github.io/text/decode.html#eJy0lMGO2zYQhs_LpxjoEruwCnlzWdjIQXFUQK0jLyw1SLBYELQ0slnTpEpStuyiQB7Cxz7dPklByUncAo6xCFYHQZz5v5nhDEXfhw-oDVdyBBOVr7Vi-erdW8AG80XNRYEaLBoL205FiO-DRqUL1PQPxaWhgm-4hRUzYFcIBZasFha2TNQ4gjunR8kWAumBLw9s2VKX5Eo6vaos3_ADalobpCturFpqtjHPoTa1sDxXghrL7BVSqJwJbvf0S4iCVkxbbrmSWFAuC2yoydmVsiutKrZkFimXVW1p2yQulxepsuwwLFFTodS6rk49LZWm5fpy2R3JpUW9ZcLYvUDadbm4whTMjfMZem6YEGpHy1oIattBulZcq00wvcQOcnKq1e4iMgyCwDG5MrYLTnfcruhJRtsx8gN-L2UaZa5Wa_4U8MZZxgCu_P8qWW2Vy7TF3Cr9vZCSkMk8CrMIsvDtNIKqXgie_9xAj9wwiJPsDpJZBsnv0-mA3CxOlm41mSVpNg_jJIOGVmvcw_08fh_OP8Fv0SfoMQjTSX9AbuLkXfQRGrqgvGigt2jtpD8mJJxm0fz_mePk12iSQZqFWZxm8SSFVw8EAOCv9u0ej22Xbau8EQSDb-ZciXojjTeCh6_GTu99XT-e6zUyiwVl1huBdxsM7_xg6AdDCIajIBgFgXcmdm3nMndzqqUDhsF57vb_bWdo95UrzDuHpTshX8BzTKvdt4C3r4e3r1vf34Mf3fLiRbbcVvhyuyaPr8aERB_vp2GcQG92nw0gSj70IY2m7lD8BL_MZ--hgTAFJXHQfdmdGhPf933CpUTtt1dvL9fKmD6Bp-M_T8fPT8fP0N5tDTww80ZJfLzgsjvVuo4nV8mFRW2gZ3WNffJvAAAA__9lEfNN # # Set a relevant session variable to a non-default value and ensure it shows up @@ -71,7 +71,7 @@ SET reorder_joins_limit = 63 query T EXPLAIN (OPT, ENV) SELECT * FROM y WHERE u = 3 ---- -https://cockroachdb.github.io/text/decode.html#eJyUk89O4zoUh9f4KY7Y0F6RC6jSCLViEYI7k5mQosTDgBCyTOK0nrpxxn9C0xUP0SfkSUZJYIMGKpaxvu_45HeOPQ-uuTZClWMIVLbUimWLi3Pga549OCFzrsFyY6HuKYRSTEBzpXOu6W8lSkOlWAkLZ_BlNAHwPMh5wZy0UDPp-BhOkecBL9mD5HQj5hs27zxYMAN2wd_iqmx5VVmxEhuuqTOcLoSxaq7ZynzGWjlpRaYkNZbZHaZUGZPCNvS1RE4rpq2wQpU8p6LM-ZqajO1ou9KqYnNmORVl5SztYhLl_F2rKHqNF1xTqdTSVS-pFkrTYvl-270pSst1zaSxjeS0Tznf4eSsnegneGGYlOqRFk5KartBtlHs6k0yPee91OJUq8d3lZPj4-PWyZSxfXH6KOyCvmC0G6PY8I-ubDczF8aaPxLO2pN_riNzVrU31TyzSn9UskQoSLBPMBD_PMJQuQcpsv8bGKA9B2FMTiGeEYh_RtEh2qtfTvqvYBanJPHDmEBDqyVv4CoJL_3kFn7gWxg48NNg-JaradGS01mCw69xT9ZDSPAUJzgOcPrawnrAWjmML_BN54l8DYP6tejUvwyjW9ivtFgx3ezDwB1CPUTDCUJ-RHDy9ofC-DsOCKTEJ2FKwiCFg7v7gwlC-OYq8sMYBrMrcgg4vh5CiqOW_Q-myewSGvj1DScYHJzBaII8z_NQ90waBM_b7fP26Xn7BJkqjdVMlHYMRydjuDsagQdHo3v0NwAA__-DroEQ +https://cockroachdb.github.io/text/decode.html#eJyUk8FO4zoUhtf4Kc6O9opcQJVGqBWLEMxMZkqKkgwDQsgyidN66sYZ-zg0XfEQfUKeZJQENmigYhnr-45__cfxPLgWxkpdjiHQ2dJoni3Oz0CsRfbgpMqFARQWoe4pQhKaghHa5MKw31qWlim5kgin8GU0AfA8yEXBnUKouXJiDCfE80CU_EEJtpHzDZ93Hiy4BVyIt7guW15XKFdyIwxzVrCFtKjnhq_sZ6yVUygzrZhFjjtMpTOuJDbsdUTOKm5QotSlyJksc7FmNuM7YldGV3zOUTBZVg5ZV5Ms5-9aRdFrohCGKa2XrnpptdCGFcv3Y_emLFGYmiuLjRKsbznf4eS83egneGm5UvqRFU4pht0i2yp2ZVPczEUvtTgz-vFd5fjo6Kh1Mm2xH84eJS7YC8a6NcqN-OjK9mXm0qL9o-C0Pfnnc-QOdXtTLTLU5qORJSFBTP2UQuqfTSlU7kHJ7P8GBmTPQRilJxDNUoh-TqcHZK9-Oem_glmUpLEfRik0rFqKBq7i8NKPb-EHvYWBAz8Jhm-5mhUteTGLafg16sl6CDG9oDGNApq8RlgPeCuH0Tm96TyZr2FQd0PJcEKIP01p_DZ2GH2nQQpJ6qdhkoZBAvt39_sTQujN1dQPIxjMrtIDoNH1EBI6bdn_4CKeXUIDv77RmIKDUxhNiOd5Hul-hobA83b7vH163j5BpkuLhssSx3B4PIa7wxF4cDi6J38DAAD__-ufef8= # Make sure it shows up correctly even if it matches the cluster setting. statement ok @@ -81,7 +81,7 @@ SET CLUSTER SETTING sql.defaults.reorder_joins_limit = 63 query T EXPLAIN (OPT, ENV) SELECT * FROM y WHERE u = 3 ---- -https://cockroachdb.github.io/text/decode.html#eJyUk89O4zoUh9f4KY7Y0F6RC6jSCLViEYI7k5mQosTDgBCyTOK0nrpxxn9C0xUP0SfkSUZJYIMGKpaxvu_45HeOPQ-uuTZClWMIVLbUimWLi3Pga549OCFzrsFyY6HuKYRSTEBzpXOu6W8lSkOlWAkLZ_BlNAHwPMh5wZy0UDPp-BhOkecBL9mD5HQj5hs27zxYMAN2wd_iqmx5VVmxEhuuqTOcLoSxaq7ZynzGWjlpRaYkNZbZHaZUGZPCNvS1RE4rpq2wQpU8p6LM-ZqajO1ou9KqYnNmORVl5SztYhLl_F2rKHqNF1xTqdTSVS-pFkrTYvl-270pSst1zaSxjeS0Tznf4eSsnegneGGYlOqRFk5KartBtlHs6k0yPee91OJUq8d3lZPj4-PWyZSxfXH6KOyCvmC0G6PY8I-ubDczF8aaPxLO2pN_riNzVrU31TyzSn9UskQoSLBPMBD_PMJQuQcpsv8bGKA9B2FMTiGeEYh_RtEh2qtfTvqvYBanJPHDmEBDqyVv4CoJL_3kFn7gWxg48NNg-JaradGS01mCw69xT9ZDSPAUJzgOcPrawnrAWjmML_BN54l8DYP6tejUvwyjW9ivtFgx3ezDwB1CPUTDCUJ-RHDy9ofC-DsOCKTEJ2FKwiCFg7v7gwlC-OYq8sMYBrMrcgg4vh5CiqOW_Q-myewSGvj1DScYHJzBaII8z_NQ90waBM_b7fP26Xn7BJkqjdVMlHYMRydjuDsagQdHo3v0NwAA__-DroEQ +https://cockroachdb.github.io/text/decode.html#eJyUk8FO4zoUhtf4Kc6O9opcQJVGqBWLEMxMZkqKkgwDQsgyidN66sYZ-zg0XfEQfUKeZJQENmigYhnr-45__cfxPLgWxkpdjiHQ2dJoni3Oz0CsRfbgpMqFARQWoe4pQhKaghHa5MKw31qWlim5kgin8GU0AfA8yEXBnUKouXJiDCfE80CU_EEJtpHzDZ93Hiy4BVyIt7guW15XKFdyIwxzVrCFtKjnhq_sZ6yVUygzrZhFjjtMpTOuJDbsdUTOKm5QotSlyJksc7FmNuM7YldGV3zOUTBZVg5ZV5Ms5-9aRdFrohCGKa2XrnpptdCGFcv3Y_emLFGYmiuLjRKsbznf4eS83egneGm5UvqRFU4pht0i2yp2ZVPczEUvtTgz-vFd5fjo6Kh1Mm2xH84eJS7YC8a6NcqN-OjK9mXm0qL9o-C0Pfnnc-QOdXtTLTLU5qORJSFBTP2UQuqfTSlU7kHJ7P8GBmTPQRilJxDNUoh-TqcHZK9-Oem_glmUpLEfRik0rFqKBq7i8NKPb-EHvYWBAz8Jhm-5mhUteTGLafg16sl6CDG9oDGNApq8RlgPeCuH0Tm96TyZr2FQd0PJcEKIP01p_DZ2GH2nQQpJ6qdhkoZBAvt39_sTQujN1dQPIxjMrtIDoNH1EBI6bdn_4CKeXUIDv77RmIKDUxhNiOd5Hul-hobA83b7vH163j5BpkuLhssSx3B4PIa7wxF4cDi6J38DAAD__-ufef8= statement ok SET enable_zigzag_join = false @@ -89,7 +89,7 @@ SET enable_zigzag_join = false query T EXPLAIN (OPT, ENV) SELECT * FROM y WHERE u = 3 ---- -https://cockroachdb.github.io/text/decode.html#eJyUk99O2zwYxo_xVbzihPYT-QBVmlArDkJwt2whRUnGQAhZJnFar66d-U9oesRF9Aq5kikJnKBRtsNEv9_jN8_reB5cM224kmMIVL7UiuaLi3Nga5Y_OC4KpsEyY6HuKYRSnIFmShdMk5-KS0MEX3ELZ_BpNAHwPChYSZ2wUFPh2BhOO4VJ-iAY2fD5hs47Ec5AleUfFSWR54GqLF_xDdPEGUYW3Fg113RlYEEN2AX7G2vlhOW5EsRYaj8whcqp4LYhrxEFqai23HIlWUG4LNiamJzK3TGVVhWdU8sIl5WzpKuKy_m7Vln2GiuZJkKppatemi2VJuXy_bF7k0vLdE2FsY1gpC-6-MApaLvVf-C5oUKoR1I6IYjtdtlW8dFsguo566UWJ1o9vqucHB8ft06ujO3DySO3C_KCkW6NfMN2HdletYIba36JHfeLOqvak2qWW6V3RUqEggT7GYbMP48wVO5B8Pz_BgZoz0EYZ6cQzzKIv0fRIdqrX970T8EsTrPED-MMGlItWQNXSXjpJ7fwDd_CwIGfBsO3XE3KlpzOEhx-jnuyHkKCpzjBcYDT1xHWA9rKYXyBbzqPF2sY1K-hU_8yjG5hv9J8RXWzDwN3CPUQDScI-VGGk7cfFMZfcZBBmvlZmGZhkMLB3f3BBCF8cxX5YQyD2VV2CDi-HkKKo5b9D6bJ7BIa-PEFJxgcnMFogjzP81D3mzQInrfb5-3T8_YJciWN1ZRLO4ajkzHcHY3Ag6PRPfodAAD__8JdgXI= +https://cockroachdb.github.io/text/decode.html#eJyUk99O2zwYxo_xVbxntJ_IB6jShFpxEILZspUUJR4DIWSZxGm9unbmP6HpERfRK-RKpiRwgkbZDhP9fo9fPa8dBHDNjRVajSHS-dJoli_Oz4Cvef7ghSy4Acetg7qnEMowAcO1KbihP7VQlkqxEg5O4dNoAhAEUPCSeemgZtLzMZx0ClfsQXK6EfMNm3cinIIuyz8qWqEgAF05sRIbbqi3nC6EdXpu2MrCgllwC_431spLJ3ItqXXMfWBKnTMpXENfIwpaMeOEE1rxggpV8DW1OVO7YyqjKzZnjlOhKu9oV5VQ83etsuw1XnJDpdZLX700W2pDy-X7Y_emUI6bmknrGslpX3TxgVOwdqv_wAvLpNSPtPRSUtftsq3io9kkM3PeSy1OjX58Vzk-OjpqnVxb14fTR-EW9AWj3RrFhu86sr1qhbDO_pI77hfzTrcn1Tx32uyKVAhFKQ4JBhKeTTFU_kGK_P8GBmjPQ5yQE0hmBJLv0-kB2qtf_vRf0SzJSBrGCYGGVkvewFUaX4bpLXzDtzDwEGbR8C1X07IlL2Ypjj8nPVkPIcUXOMVJhLPXEdYD1spxco5vOk8UaxjUXSgaThAKpwSnb8eOk684IpCRkMQZiaMM9u_u9ycI4ZuraRgnMJhdkQPAyfUQMjxt2f_gIp1dQgM_vuAUg4dTGE1QEAQB6h5Dg-B5u33ePj1vnyDXyjrDhHJjODwew93hCAI4HN2j3wEAAP__IGl6YQ== statement ok SET optimizer_use_histograms = false @@ -97,7 +97,7 @@ SET optimizer_use_histograms = false query T EXPLAIN (OPT, ENV) SELECT * FROM y WHERE u = 3 ---- -https://cockroachdb.github.io/text/decode.html#eJyUk81O4zwUhtf4Ko7Y0H4iH6BKI9SKRQjuTGZCipIMA0LIMonTeuraGf-EpisuolfIlYySwAZB0SwTPc_rk_c4ngfXTBuu5BgClS-1ovni4hzYmuUPjouCabDMWKh7CqEUZ6CZ0gXT5Lfi0hDBV9zCGXwZTQA8DwpWUics1FQ4NobTTmGSPghGNny-ofNOhDNQZfmuomTnqMryFd8wTZxhZMGNVXNNV2a36XlvxJUTludKEGOpNbCgBuyCvW8KlVPBbUNeIwpSUW255UqygnBZsDUxOZW7YyqtKjqnlhEuK2dJVxeX8w-tsuw1VjJNhFJLV720WypNyuXHY_cml5bpmgpjG8FIX3bxiVPQdrP_wHNDhVCPpHRCENvts63is9kE1XPWSy1OtHr8UDk5Pj5unVwZ24eTR24X5AUj3Rr5hu06sr06BTfW_BE7bgp1VrUn1Sy3Su-KlAgFCfYzDJl_HmGo3IPg-f8NDNCegzDOTiGeZRD_jKJDtFe_vOmfglmcZokfxhk0pFqyBq6S8NJPbuEHvoWBAz8Nhm-5mpQtOZ0lOPwa92Q9hARPcYLjAKevI6wHtJXD-ALfdB4v1jCoX0On_mUY3cJ-pfmK6mYfBu4Q6iEaThDyowwnbz8ojL_jIIM087MwzcIghYO7-4MJQvjmKvLDGAazq-wQcHw9hBRHLfsfTJPZJTTw6xtOMDg4g9EEeZ7noe43aRA8b7fP26fn7RPkShqrKZd2DEcnY7g7GoEHR6N79DcAAP__PjmB1A== +https://cockroachdb.github.io/text/decode.html#eJyUk81O4zwUhtf4Ks6O9hP5AFUaoVYsQjAzmSkpSjwMCCHLJE7rqWtn_BOarriIXiFXMkoCGwRFs0z0PK-P3mMHAVxzY4VWY4h0vjSa5YvzM-Brnj94IQtuwHHroO4phDJMwHBtCm7oby2UpVKshINT-DKaAAQBFLxkXjqomfR8DCedwhV7kJxuxHzD5p0Ip6DL8l1Fq87RlRMrseGGesvpQlin54at7G4zCN6IKy-dyLWk1jFnYcEsuAV_35Q6Z1K4hr5GFLRixgkntOIFFarga2pzpnbHVEZXbM4cp0JV3tGuLqHmH1pl2Wu85IZKrZe-emm31IaWy4_H7k2hHDc1k9Y1ktO-7OITp2DtZv-BF5ZJqR9p6aWkrttnW8Vns0lm5ryXWpwa_fihcnx0dNQ6ubauD6ePwi3oC0a7NYoN33Vke3UKYZ39I3fcFOadbk-qee602RWpEIpSHBIMJDybYqj8gxT5_w0M0J6HOCEnkMwIJD-n0wO0V7_86b-iWZKRNIwTAg2tlryBqzS-DNNb-IFvYeAhzKLhW66mZUtezFIcf016sh5Cii9wipMIZ68jrAeslePkHN90nijWMKi7UDScIBROCU7fjh0n33FEICMhiTMSRxns393vTxDCN1fTME5gMLsiB4CT6yFkeNqy_8FFOruEBn59wykGD6cwmqAgCALUPYYGwfN2-7x9et4-Qa6VdYYJ5cZweDyGu8MRBHA4ukd_AwAA__-SQnrD statement ok SET optimizer_use_multicol_stats = false @@ -105,7 +105,7 @@ SET optimizer_use_multicol_stats = false query T EXPLAIN (OPT, ENV) SELECT * FROM y WHERE u = 3 ---- -https://cockroachdb.github.io/text/decode.html#eJyUk89O4zoUxtf4KY7Y0F6RC6jSFWrFIgT3TmZCipIMA0LIMonTeuraGf8JTVc8RJ-QJxklgQ0CKpaJfr_PJ-eLPQ-umTZcyTEEKl9qRfPFxTmwNcsfHBcF02CZsVD3FEIpzkAzpQumyW_FpSGCr7iFM_hvNAHwPChYSZ2wUFPh2BhOO4VJ-iAY2fD5hs47Ec5AleW7ipKdoyrLV3zDNHGGkQU3Vs01XZmvmisnLM-VIMZSu8P2PBAqp4LbhrymFKSi2nLLlWQF4bJga2JyKmFBDdgFez-m0qqic2oZ4bJylnQr43L-oVWWvcZKpolQaumqlw2XSpNyaXaYXFqmayqMbQQj_cKLHU5B23a_wHNDhVCPpHRCENt12q5i12yC6jnrpRYnWj1-qJwcHx-3Tq6M7cPJI7cL8oKRrkm-YZ8d2f4EBTfW_BGf9E2dVe1JNcut0p9FSoSCBPsZhsw_jzBU7kHw_N8GBmjPQRhnpxDPMoh_RtEh2qtf3vRPwSxOs8QP4wwaUi1ZA1dJeOknt_AD38LAgZ8Gw7dcTcqWnM4SHP4f92Q9hARPcYLjAKevI6wHtJXD-ALfdB4v1jCoX0On_mUY3cJ-pfmK6mYfBu4Q6iEaThDyowwnbz8ojL_jIIM087MwzcIghYO7-4MJQvjmKvLDGAazq-wQcHw9hBRHLfsPTJPZJTTw6xtOMDg4g9EEeZ7noe6aNAiet9vn7dPz9glyJY3VlEs7hqOTMdwdjcCDo9E9-hsAAP___GiCNg== +https://cockroachdb.github.io/text/decode.html#eJyUk89O4zoUxtf4Kc6O9opcQJWuUCsWIZg7mSkpSjwMCCHLJE7rqWtn_Cc0XfEQfUKeZJQENgioWCb6_b5zdL4kCOCaGyu0GkOk86XRLF-cnwFf8_zBC1lwA45bB3VPIZRhAoZrU3BDf2uhLJViJRycwn-jCUAQQMFL5qWDmknPx3DSKVyxB8npRsw3bN6JcAq6LN9VtOocXTmxEhtuqLecLoR1em7Yyn7VXHnpRK4ltY65HXYQgNQ5k8I19DWloBUzTjihFS-oUAVfU5szBQtmwS34-zGV0RWbM8epUJV3tDuZUPMPrbLsNV5yQ6XWS1-9XLjUhpZLu8MUynFTM2ldIzntD17scArWtvsFXlgmpX6kpZeSuq7T9hS7dpPMzHkvtTg1-vFD5fjo6Kh1cm1dH04fhVvQF4x2TYoN_2xk-xEUwjr7R37SN_NOt5NqnjttPotUCEUpDgkGEp5NMVT-QYr83wYGaM9DnJATSGYEkp_T6QHaq1_e9E_RLMlIGsYJgYZWS97AVRpfhukt_MC3MPAQZtHwLVfTsiUvZimO_096sh5Cii9wipMIZ68rrAeslePkHN90nijWMKi7UDScIBROCU7frh0n33FEICMhiTMSRxns393vTxDCN1fTME5gMLsiB4CT6yFkeNqy_8BFOruEBn59wykGD6cwmqAgCALU_QwNguft9nn79Lx9glwr6wwTyo3h8HgMd4cjCOBwdI_-BgAA__9GjHsl statement ok RESET reorder_joins_limit @@ -141,7 +141,7 @@ CREATE VIEW v AS SELECT a, b, u, v FROM x, y WHERE b = 3 query T EXPLAIN (OPT, ENV) SELECT * FROM v ---- -https://cockroachdb.github.io/text/decode.html#eJy0Vd1u2zYUvg6f4kA3tQepkWNgKGwEmOoymzZHDmQtbRAEBC3RNhda1EhKsTIMKPYMvtzT5UkGSnbitnGDYqgvDPDw-87vd0TPg0umNJf5AEYyvVWSpst3b4GtWToruciYAsO0gapFITTFCSgmVcYU-UPyXBPBV9zAKfzYHwJ4HmRsTkthoKKiZAN4gzwPWE5ngpF7vrini4YHS6rBLNnncJlbvCwMX_F7pkipGVlybeRC0ZX-FtaqFIanUhBtqHmBKWRKBTc12bnISEGV4YbLnGWE5xlbE53SF9IulCzoghpGeF6UhjRt4vniIGs-b2lszhQRUt6Wxbarc6nI_PZw2i2T54apigptasFI2-XsBU5G7US_Ac81FULekXkpBDHNIG0rXspNULVgLcnCiZJ3Byk93_ctJ5XatM7JHTdLsoWRZoz8nn0tpFVmxrXRfwo4tZZn5UhLI22kiqVGqq-5zBEaxThIMCTB2zGGopwJnr5eQwcdUQij5A1EkwSi38djFx3Ntpb2NJpE0yQOwiiBNSluWQ0XcXgexFfwG76CDoVgOuq66CiM3uEPsCYzwrM1dGY7-1lwHo6vwCkUX1FVO9ChLsy6qDtEKBgnOP48pzD6FY8SmCZBEk6TcDSFV9cIAOCv5t_-HFotmiY6A_DdJ3MqRbnKtTOA60dji3cezzf7eMWoYRmhxhmAc-L33nh-z_N74PcGvj_wfWcPbAfC89ROsMwtoefvx242u5muqQubmLNPzq12dsR9mpJ3Tw5P-r2TfnP3t_t_S559l5KbDL9f1ejm1fB5rdZWq-UXWq0OabV-RqvlTpOf4Coyt8izSYzDn6MWWXUhxmc4xtEITx-l2aFPQre8RujVYaGXLlQHhV4_K_T9-i9D_H6HrppVtcvpoqPSFo66EExhisfWh10pF2w8OIsn581D93qXtvvJsYb3v-AYwwxOoT9ECH-4GAdhBJ3JReICji67O6c_tL6qIfI8z0M8z5nymgevkyqpdRfBw-bfh83Hh81HaF6U-gvL-qftF8He_GNn_LDZbAGpzLVRlOdmAMcnx70BXB_3wYPj_g3ag825MExp6BhVsi76LwAA__9onmWt +https://cockroachdb.github.io/text/decode.html#eJy0Vd1u2zYUvg6f4sA3tQepkWNgCBwEmOsymzZXDmQtbREEBC1RNhea1EhKsTIMKPYMvtzT5UkGSnbitvlBMVQXAnj4fef3O6DvwwXThis5hLFKr7Wi6fLtG2Brls5LLjKmwTJjoWpRCM1wApopnTFN_lBcGiL4ils4hR8HJwC-DxnLaSksVFSUbAjHyPeBSToXjNzyxS1dNDxYUgN2yb6EK-nwqrB8xW-ZJqVhZMmNVQtNV-ZbWKtSWJ4qQYyl9gWmUCkV3NZk5yIjBdWWW64kywiXGVsTk9IX0i60KuiCWka4LEpLmjZxuXiSlectjeVME6HUdVlsu5orTfLrp9NumVxapisqjK0FI22Xsxc4GXUT_QY8N1QIdUPyUghim0G6VryUm6B6wVqSgxOtbp6k9IMgcJxUGds6JzfcLskWRpox8lv2XEinzIwba_4UcOosj8qRlla5SBVLrdLPuZQIjWM8SjAkozcTDEU5Fzx9vYYuOqAQRskxRNMEot8nEw8dzLeW9jSeRrMkHoVRAmtSXLMazuPw3Sj-CL_hj9ClMJqNex46CKO3-AOsyZzwbA3deWNHvROERpMEx19GDqNf8TiBWTJKwlkSjmfw6hIBAPzV_N3XodWiaVVnCIH3YE6VKFfSdIZweW9s8Z3789U-XjNqWUao7QyhcxT0j_2g7wd9CPrDIBgGQWcP7NrOZermVEpH6Af7sZv9bWZo68Il1tknS6eQHXGfptXNg8OjQf9o0Nz97f3fkuffpeQmw-9XNbp6dfK4ImunyPIrRVZPKbJ-RJHlTpGf4SqSO-TZNMbhz1GLrHoQ4zMc42iMZ_fS7NIHOTteI-fqWTnXj8p5v8qLEL_foatm7dyieeigdOWhHoxmMMMT54N6MPeg9KCCs3j6rnm0Xu-S8z471vD-FxxjmMMpDE4Qwh_OJ6Mwgu70PPEARxe9ndMfWl_VCfJ930dcSqb95vHqploZ00Nwt_n3bvPpbvMJmteh_sqy_mm73e7mHzfJu81mC0iVNFZTLu0QDo8O-0O4PByAD4eDK7QHy7mwTBvoWl2yHvovAAD__-qlV7M= # # Test tables in user-defined schemas. @@ -154,4 +154,4 @@ CREATE TABLE s.t (a int primary key) query T EXPLAIN (OPT, ENV) SELECT * FROM s.t; ---- -https://cockroachdb.github.io/text/decode.html#eJyUkkFr20wQhs_eXzHkEvvD-nAplBCTg6IqoFaWjbQNNaUsG2kkb73WqrsjO_avL5JSKKWOyXV4npnhnfE8eETrlKlvITD51hqZbz7eAz5j_tQqXaAFQkewHyjGspCDRWMLtOKHUbUTWu0UwR18eD8H8DwosJStJthL3eIt3DDPA6zlk0ZxUtVJVr0HG-mANvg3buqONw2pnTqhFa1DsVGOTGXlzr3F2rWaVG60cCTpgqlNLrWio_jdohCNtKRImRoLoeoCn4XL5YW1G2saWUlCoeqmJdHHpOrqrFWWg4YlWqGN2bbNS6qlsaLcnl97MFVNaPdSOzpqFEPKxQWnkN1F38ArJ7U2B1G2WgvqD9lFcWk3LW2Fg9ThwprDWeXdbDbrnNw4GpqLg6KNeMFEf0Z1wtdGdp9ZKEfup4a7rvLPd5QtmW7SHnMy9rWWNWNBGvo8BO7fxyG4_wnGbCQhSvgNJEsOyZc4nrJRsEwynvpRwoFEs8UjrNJo4adr-ByuYSzBz4LJlI0e_EUUr-GqsWon7fEKxnLCJnPG_JiH6R9TouRTGHDIuM-jjEdBBtffvl_PGQu_rmI_SmC8XPEphMnjBLIw7tj_4CFdLjp7zjzP81j_rMR-BQAA__-oFVBT +https://cockroachdb.github.io/text/decode.html#eJyUklFr2zAQx5-rT3FvbUY9MgajNPTB9Tzw5jrB1srKGIdqnx0tiuVJ56TJpx-OOxhjaeir-P3-Ov53QQD35Ly27TVEtlw5q8rlx1ugJyofe20qcsDkGTYjJUQRS3BkXUUOf1rdejR6rRlu4MP7GUAQQEW16g3DRpmeruFKBAFQqx4N4V43e9UcPFgqD7ykf3HbDrztWK_1nhz2nnCpPdvGqbV_jbXuDevSGvSs-IRpbKmM5h3-iaiwU441a9tShbqt6Al9qU6M3TnbqUYxoW67nvFQk26bo1ZdjxrV5NBYu-q751Zr67BeHR97NHXL5DbKeN4ZwrHl6oRTqWGjr-C1V8bYLda9MciHRQ5VnJrNKNfQKA04Ors9qrybTqeDU1rPYzhuNS_xGcPDGvWeXvpyuMxKe_a_DNwML_89R9WzHX7aUMnWvRTZChHlcShjkOFtGoN_y3AhzhQkmbyCbC4h-5qml-IsmmeFzMMkk8DYrWgHizy5C_MH-BI_wIWCsIgmYjITIkxlnP8Vl2Sf40hCIUOZFDKJCjj__uN8JkT8bZGGSQYX84W8hDi7n0ARpwP7Bj7l87vBnokgCAJxuEoWvwMAAP__iItKGA== diff --git a/pkg/sql/opt/exec/execbuilder/testdata/hash_sharded_index b/pkg/sql/opt/exec/execbuilder/testdata/hash_sharded_index index 2dfb7df39fa9..8a2efc81eb7a 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/hash_sharded_index +++ b/pkg/sql/opt/exec/execbuilder/testdata/hash_sharded_index @@ -165,10 +165,9 @@ query T SELECT @2 FROM [SHOW CREATE TABLE t] ---- CREATE TABLE public.t ( - crdb_internal_a_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 8:::INT8)) VIRTUAL, - a INT8 NOT NULL, - CONSTRAINT t_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=8), - FAMILY "primary" (a) + crdb_internal_a_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 8:::INT8)) VIRTUAL, + a INT8 NOT NULL, + CONSTRAINT t_pkey PRIMARY KEY (a ASC) USING HASH WITH (bucket_count=8) ) query T diff --git a/pkg/sql/opt/exec/execbuilder/testdata/sql_fn b/pkg/sql/opt/exec/execbuilder/testdata/sql_fn index 816714708bab..3e04e627d985 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/sql_fn +++ b/pkg/sql/opt/exec/execbuilder/testdata/sql_fn @@ -44,8 +44,7 @@ SELECT create_statement FROM [SHOW CREATE TABLE my_spatial_table] CREATE TABLE public.my_spatial_table ( k INT8 NOT NULL, geom1 GEOMETRY(POINT,4326) NULL, - CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC), - FAMILY "primary" (k, geom1) + CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC) ) query T @@ -60,8 +59,7 @@ CREATE TABLE public.my_spatial_table ( k INT8 NOT NULL, geom1 GEOMETRY(POINT,4326) NULL, geom2 GEOMETRY(POLYGON,4326) NULL, - CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC), - FAMILY "primary" (k, geom1, geom2) + CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC) ) query T @@ -77,8 +75,7 @@ CREATE TABLE public.my_spatial_table ( geom1 GEOMETRY(POINT,4326) NULL, geom2 GEOMETRY(POLYGON,4326) NULL, geom3 GEOMETRY(MULTIPOLYGON,4326) NULL, - CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC), - FAMILY "primary" (k, geom1, geom2, geom3) + CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC) ) query T @@ -95,8 +92,7 @@ CREATE TABLE public.my_spatial_table ( geom2 GEOMETRY(POLYGON,4326) NULL, geom3 GEOMETRY(MULTIPOLYGON,4326) NULL, geom4 GEOMETRY(LINESTRING,4326) NULL, - CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC), - FAMILY "primary" (k, geom1, geom2, geom3, geom4) + CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC) ) query T @@ -114,8 +110,7 @@ CREATE TABLE public.my_spatial_table ( geom3 GEOMETRY(MULTIPOLYGON,4326) NULL, geom4 GEOMETRY(LINESTRING,4326) NULL, geom5 GEOMETRY(MULTIPOINT,4326) NULL, - CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC), - FAMILY "primary" (k, geom1, geom2, geom3, geom4, geom5) + CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC) ) query T @@ -134,8 +129,7 @@ CREATE TABLE public.my_spatial_table ( geom4 GEOMETRY(LINESTRING,4326) NULL, geom5 GEOMETRY(MULTIPOINT,4326) NULL, geom6 GEOMETRY(MULTILINESTRING,4326) NULL, - CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC), - FAMILY "primary" (k, geom1, geom2, geom3, geom4, geom5, geom6) + CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC) ) query error relation "missing_table" does not exist @@ -236,8 +230,7 @@ CREATE TABLE public.my_spatial_table ( geom6 GEOMETRY(MULTILINESTRING,4326) NULL, geom7 GEOMETRY(POINT,4326) NULL, geom8 GEOMETRY(POINT,4326) NULL, - CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC), - FAMILY "primary" (k, geom1, geom2, geom3, geom4, geom5, geom6, geom7, geom8) + CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC) ) # In a WHERE clause. @@ -268,8 +261,7 @@ CREATE TABLE public.my_spatial_table ( geom8 GEOMETRY(POINT,4326) NULL, geom9 GEOMETRY(GEOMETRY,4326) NULL, geom10 GEOMETRY(GEOMETRYCOLLECTION) NULL, - CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC), - FAMILY "primary" (k, geom1, geom2, geom3, geom4, geom5, geom6, geom7, geom8, geom9, geom10) + CONSTRAINT my_spatial_table_pkey PRIMARY KEY (k ASC) ) # Regression test for #50296. Using AddGeometryColumn with NULL arguments must diff --git a/pkg/sql/schema_changer_test.go b/pkg/sql/schema_changer_test.go index 0717e45ad465..81223137faa4 100644 --- a/pkg/sql/schema_changer_test.go +++ b/pkg/sql/schema_changer_test.go @@ -2290,8 +2290,7 @@ INSERT INTO t.test VALUES (1, 1, 1), (2, 2, 2), (3, 3, 3); y INT8 NOT NULL, z INT8 NULL, CONSTRAINT test_pkey PRIMARY KEY (x ASC), - INDEX i (z ASC), - FAMILY "primary" (x, y, z) + INDEX i (z ASC) )` if create != expected { t.Fatalf("expected %s, found %s", expected, create) @@ -2312,8 +2311,7 @@ INSERT INTO t.test VALUES (1, 1, 1), (2, 2, 2), (3, 3, 3); z INT8 NULL, CONSTRAINT test_pkey PRIMARY KEY (y ASC), UNIQUE INDEX test_x_key (x ASC), - INDEX i (z ASC), - FAMILY "primary" (x, y, z) + INDEX i (z ASC) )` if create != expected { t.Fatalf("expected %s, found %s", expected, create) @@ -3473,8 +3471,7 @@ INSERT INTO t.test (k, v, length) VALUES (2, 3, 1); v INT8 NULL, length INT8 NOT NULL, CONSTRAINT "primary" PRIMARY KEY (k ASC), - INDEX v_idx (v ASC), - FAMILY "primary" (k, v, length) + INDEX v_idx (v ASC) )` if create != expect { t.Fatalf("got: %s\nexpected: %s", create, expect) diff --git a/pkg/sql/show_create_clauses.go b/pkg/sql/show_create_clauses.go index 776326a127f0..35a188398e5f 100644 --- a/pkg/sql/show_create_clauses.go +++ b/pkg/sql/show_create_clauses.go @@ -22,6 +22,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" "github.com/cockroachdb/cockroach/pkg/sql/catalog/multiregion" "github.com/cockroachdb/cockroach/pkg/sql/catalog/schemaexpr" + "github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc" "github.com/cockroachdb/cockroach/pkg/sql/parser" "github.com/cockroachdb/cockroach/pkg/sql/rowenc" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" @@ -396,7 +397,13 @@ func ShowCreateSequence( // showFamilyClause creates the FAMILY clauses for a CREATE statement, writing them // to tree.FmtCtx f func showFamilyClause(desc catalog.TableDescriptor, f *tree.FmtCtx) { - for _, fam := range desc.GetFamilies() { + // Do not show family in SHOW CREATE TABLE if there is only one and + // it is named "primary". + families := desc.GetFamilies() + if len(families) == 1 && families[0].Name == tabledesc.FamilyPrimaryName { + return + } + for _, fam := range families { activeColumnNames := make([]string, 0, len(fam.ColumnNames)) for i, colID := range fam.ColumnIDs { if col, _ := desc.FindColumnWithID(colID); col != nil && col.Public() { diff --git a/pkg/sql/show_test.go b/pkg/sql/show_test.go index 432e738acb15..44cc38b200ac 100644 --- a/pkg/sql/show_test.go +++ b/pkg/sql/show_test.go @@ -108,8 +108,7 @@ func TestShowCreateTable(t *testing.T) { )`, Expect: `CREATE TABLE public.%[1]s ( i INT8 NOT NULL, - CONSTRAINT %[1]s_pkey PRIMARY KEY (i ASC), - FAMILY "primary" (i) + CONSTRAINT %[1]s_pkey PRIMARY KEY (i ASC) )`, }, { @@ -136,13 +135,11 @@ func TestShowCreateTable(t *testing.T) { { CreateStatement: `CREATE TABLE %s ( "te""st" INT8 NOT NULL, - CONSTRAINT "pri""mary" PRIMARY KEY ("te""st" ASC), - FAMILY "primary" ("te""st") + CONSTRAINT "pri""mary" PRIMARY KEY ("te""st" ASC) )`, Expect: `CREATE TABLE public.%[1]s ( "te""st" INT8 NOT NULL, - CONSTRAINT "pri""mary" PRIMARY KEY ("te""st" ASC), - FAMILY "primary" ("te""st") + CONSTRAINT "pri""mary" PRIMARY KEY ("te""st" ASC) )`, }, { @@ -156,8 +153,7 @@ func TestShowCreateTable(t *testing.T) { b INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), - INDEX c (a ASC, b DESC), - FAMILY "primary" (a, b, rowid) + INDEX c (a ASC, b DESC) )`, }, @@ -168,8 +164,7 @@ func TestShowCreateTable(t *testing.T) { Expect: `CREATE TABLE public.%[1]s ( pk INT8 NOT NULL, crdb_internal_expiration TIMESTAMPTZ NOT VISIBLE NOT NULL DEFAULT current_timestamp():::TIMESTAMPTZ + '00:10:00':::INTERVAL ON UPDATE current_timestamp():::TIMESTAMPTZ + '00:10:00':::INTERVAL, - CONSTRAINT %[1]s_pkey PRIMARY KEY (pk ASC), - FAMILY "primary" (pk, crdb_internal_expiration) + CONSTRAINT %[1]s_pkey PRIMARY KEY (pk ASC) ) WITH (ttl = 'on', ttl_automatic_column = 'on', ttl_expire_after = '00:10:00':::INTERVAL)`, }, // Check that FK dependencies inside the current database @@ -188,8 +183,7 @@ func TestShowCreateTable(t *testing.T) { rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), CONSTRAINT %[1]s_i_j_fkey FOREIGN KEY (i, j) REFERENCES public.items(a, b), - CONSTRAINT %[1]s_k_fkey FOREIGN KEY (k) REFERENCES public.items(c), - FAMILY "primary" (i, j, k, rowid) + CONSTRAINT %[1]s_k_fkey FOREIGN KEY (k) REFERENCES public.items(c) )`, }, // Check that FK dependencies using MATCH FULL on a non-composite key still @@ -208,8 +202,7 @@ func TestShowCreateTable(t *testing.T) { rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), CONSTRAINT %[1]s_i_j_fkey FOREIGN KEY (i, j) REFERENCES public.items(a, b) MATCH FULL, - CONSTRAINT %[1]s_k_fkey FOREIGN KEY (k) REFERENCES public.items(c) MATCH FULL, - FAMILY "primary" (i, j, k, rowid) + CONSTRAINT %[1]s_k_fkey FOREIGN KEY (k) REFERENCES public.items(c) MATCH FULL )`, }, // Check that FK dependencies outside of the current database @@ -223,8 +216,7 @@ func TestShowCreateTable(t *testing.T) { x INT8 NULL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), - CONSTRAINT fk_ref FOREIGN KEY (x) REFERENCES o.public.foo(x), - FAMILY "primary" (x, rowid) + CONSTRAINT fk_ref FOREIGN KEY (x) REFERENCES o.public.foo(x) )`, }, // Check that FK dependencies using SET NULL or SET DEFAULT @@ -243,8 +235,7 @@ func TestShowCreateTable(t *testing.T) { rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), CONSTRAINT %[1]s_i_j_fkey FOREIGN KEY (i, j) REFERENCES public.items(a, b) ON DELETE SET DEFAULT, - CONSTRAINT %[1]s_k_fkey FOREIGN KEY (k) REFERENCES public.items(c) ON DELETE SET NULL, - FAMILY "primary" (i, j, k, rowid) + CONSTRAINT %[1]s_k_fkey FOREIGN KEY (k) REFERENCES public.items(c) ON DELETE SET NULL )`, }, // Check that FK dependencies using MATCH FULL and MATCH SIMPLE are both @@ -266,8 +257,7 @@ func TestShowCreateTable(t *testing.T) { rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), CONSTRAINT %[1]s_i_j_fkey FOREIGN KEY (i, j) REFERENCES public.items(a, b) ON DELETE SET DEFAULT, - CONSTRAINT %[1]s_k_l_fkey FOREIGN KEY (k, l) REFERENCES public.items(a, b) MATCH FULL ON UPDATE CASCADE, - FAMILY "primary" (i, j, k, l, rowid) + CONSTRAINT %[1]s_k_l_fkey FOREIGN KEY (k, l) REFERENCES public.items(a, b) MATCH FULL ON UPDATE CASCADE )`, }, // Check hash sharded indexes are round trippable. @@ -281,8 +271,7 @@ func TestShowCreateTable(t *testing.T) { crdb_internal_a_shard_8 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(crdb_internal.datums_to_bytes(a)), 8:::INT8)) VIRTUAL, rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(), CONSTRAINT %[1]s_pkey PRIMARY KEY (rowid ASC), - INDEX %[1]s_a_idx (a ASC) USING HASH WITH (bucket_count=8), - FAMILY "primary" (a, rowid) + INDEX %[1]s_a_idx (a ASC) USING HASH WITH (bucket_count=8) )`, }, }