Skip to content

Commit

Permalink
*: fix mechanical tests for changing PRIMARY INDEX default constraint…
Browse files Browse the repository at this point in the history
… name

Separated out from logic changes (previous commit), can squash before
merging.

Release note: None
  • Loading branch information
otan committed Oct 14, 2021
1 parent ef2324f commit 514dfd6
Show file tree
Hide file tree
Showing 209 changed files with 4,055 additions and 4,069 deletions.
8 changes: 4 additions & 4 deletions pkg/ccl/backupccl/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ ORDER BY object_type, object_name`, full)
expectedCreateTable := `CREATE TABLE tablea (
a INT8 NOT NULL,
b INT8 NULL,
CONSTRAINT "primary" PRIMARY KEY (a ASC),
CONSTRAINT tablea_pkey PRIMARY KEY (a ASC),
INDEX tablea_b_idx (b ASC),
FAMILY "primary" (a, b)
)`
Expand Down Expand Up @@ -247,14 +247,14 @@ ORDER BY object_type, object_name`, full)
wantSameDB := `CREATE TABLE fkreftable (
a INT8 NOT NULL,
b INT8 NULL,
CONSTRAINT "primary" PRIMARY KEY (a ASC),
CONSTRAINT fkreftable_pkey PRIMARY KEY (a ASC),
CONSTRAINT fk_b_ref_fksrc FOREIGN KEY (b) REFERENCES public.fksrc(a),
FAMILY "primary" (a, b)
)`
wantDiffDB := `CREATE TABLE fkreftable (
a INT8 NOT NULL,
b INT8 NULL,
CONSTRAINT "primary" PRIMARY KEY (a ASC),
CONSTRAINT fkreftable_pkey PRIMARY KEY (a ASC),
CONSTRAINT fk_b_ref_fksrc FOREIGN KEY (b) REFERENCES data.public.fksrc(a),
FAMILY "primary" (a, b)
)`
Expand All @@ -280,7 +280,7 @@ ORDER BY object_type, object_name`, full)
want := `CREATE TABLE fkreftable (
a INT8 NOT NULL,
b INT8 NULL,
CONSTRAINT "primary" PRIMARY KEY (a ASC),
CONSTRAINT fkreftable_pkey PRIMARY KEY (a ASC),
FAMILY "primary" (a, b)
)`

Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/testdata/backup-restore/virtual-columns
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ d.public.tab CREATE TABLE public.tab (
a INT8 NULL,
b INT8 NULL,
v INT8 NULL AS (a + b) VIRTUAL,
CONSTRAINT "primary" PRIMARY KEY (k ASC),
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)
Expand Down
3 changes: 2 additions & 1 deletion pkg/ccl/importccl/exportcsv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ func TestExportImportBank(t *testing.T) {
fmt.Sprintf(`SELECT * FROM bank AS OF SYSTEM TIME %s ORDER BY id`, asOf), db.QueryStr(t, `SELECT * FROM bank2 ORDER BY id`),
)
db.CheckQueryResults(t,
`SHOW EXPERIMENTAL_FINGERPRINTS FROM TABLE bank2`, db.QueryStr(t, `SHOW EXPERIMENTAL_FINGERPRINTS FROM TABLE bank`),
`SELECT fingerprint FROM [SHOW EXPERIMENTAL_FINGERPRINTS FROM TABLE bank2]`,
db.QueryStr(t, `SELECT fingerprint FROM [SHOW EXPERIMENTAL_FINGERPRINTS FROM TABLE bank]`),
)
db.Exec(t, "DROP TABLE bank2")
})
Expand Down
10 changes: 5 additions & 5 deletions pkg/ccl/importccl/import_stmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ END;
`CREATE TABLE public.t (
a INT8 NOT NULL,
b INT8 NOT NULL,
CONSTRAINT "primary" PRIMARY KEY (a ASC),
CONSTRAINT t_pkey PRIMARY KEY (a ASC),
FAMILY "primary" (a, b)
)`,
},
Expand All @@ -1016,7 +1016,7 @@ END;
a INT8 NOT NULL,
b INT8 NOT VISIBLE NULL,
c INT8 NULL,
CONSTRAINT "primary" PRIMARY KEY (a ASC),
CONSTRAINT t_pkey PRIMARY KEY (a ASC),
FAMILY "primary" (a, b, c)
)`,
},
Expand All @@ -1037,7 +1037,7 @@ END;
`CREATE TABLE public.t (
a INT8 NOT NULL,
b INT8 NULL DEFAULT 8:::INT8,
CONSTRAINT "primary" PRIMARY KEY (a ASC),
CONSTRAINT t_pkey PRIMARY KEY (a ASC),
FAMILY "primary" (a, b)
)`,
},
Expand Down Expand Up @@ -1463,7 +1463,7 @@ const (
prcp FLOAT4 NULL,
date DATE NULL,
rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(),
CONSTRAINT "primary" PRIMARY KEY (rowid ASC),
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)
)`
Expand Down Expand Up @@ -5614,7 +5614,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 "primary" PRIMARY KEY (rowid ASC),
CONSTRAINT seqtable_pkey PRIMARY KEY (rowid ASC),
FAMILY "primary" (a, b, rowid)
)`,
}})
Expand Down
594 changes: 297 additions & 297 deletions pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/ccl/logictestccl/testdata/logic_test/auto_rehoming_mixed
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +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,
CONSTRAINT "primary" PRIMARY KEY (p ASC),
CONSTRAINT rbr_pkey PRIMARY KEY (p ASC),
FAMILY "primary" (p, s, crdb_region)
) LOCALITY REGIONAL BY ROW

Expand All @@ -40,6 +40,6 @@ 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,
CONSTRAINT "primary" PRIMARY KEY (p ASC),
CONSTRAINT rbr_altered_pkey PRIMARY KEY (p ASC),
FAMILY "primary" (p, crdb_region)
) LOCALITY REGIONAL BY ROW
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SHOW CREATE TABLE p
----
p CREATE TABLE public.p (
a INT8 NOT NULL,
CONSTRAINT "primary" PRIMARY KEY (a ASC),
CONSTRAINT p_pkey PRIMARY KEY (a ASC),
FAMILY "primary" (a)
) PARTITION BY LIST (a) (
PARTITION p1 VALUES IN ((1)),
Expand Down
Loading

0 comments on commit 514dfd6

Please sign in to comment.