You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sql/schemachanger: simplify validation for CTAS statements
Previously, the validation we used for CTAS statements would re-run the
same query using the same AOST. This worked fine for deterministic
queries, where the count between the re-executed query and backfill
would match. However, if the query was non-deterministic (e.g., due to
non-deterministic functions/routines), this check would fail. To address
this, this patch removes the AOST query validation and only uses the row
count from the bulk writer
Fixes: #153363
Release note: None
returnerrors.AssertionFailedf("backfill query did not populate index %q with expected number of rows (expected: %d, got: %d)", index.GetName(), aostEntryCount, newTblEntryCount)
runner.Exec(t, "CREATE TABLE simple_copy AS (SELECT * FROM t1)")
8059
+
// Row count is can change.
8060
+
runner.Exec(t, "CREATE TABLE t_random AS (SELECT * FROM t1 WHERE random() > 0.5)")
8061
+
runner.Exec(t, " CREATE TABLE t_random2 AS (SELECT * FROM generate_series(0, CAST((100 * random()) AS INT)));")
8053
8062
// Execute a CTAS and CREATE MATERIALIZED VIEW statements that should fail.
8063
+
hookEnabled.Store(true)
8054
8064
runner.ExpectErr(t, "backfill query did not populate index \"t2_pkey\" with expected number of rows", "CREATE TABLE t2 AS (SELECT * FROM t1)")
8055
8065
runner.ExpectErr(t, "backfill query did not populate index \"t2_pkey\" with expected number of rows", "CREATE MATERIALIZED VIEW t2 AS (SELECT n FROM t1)")
0 commit comments