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
cf1271c claimed to have already
completed this, however, due to an unfortunate git typo the original
contents of that commit were replaced with a small refactor. This
commit applies the original contents of
cf1271c. The original commit message
is copied below.
System views from pg_catalog and mz_catalog are sometimes used by
applications (for example Metabase if it doesn't recognize a data type)
after the first query of a transaction. This previously would cause a
timedomain error. One solution to this is to always include system indexes
in read transactions. The cost is mostly that system indexes can now be
held back from compaction more than previously. This seems ok because
they don't change quickly, so should hopefully not cause memory issues.
Fixes #9375
Fixes #9374
Fixes #21815
Co-authored-by: Matt Jibson <matt.jibson@gmail.com>
Copy file name to clipboardExpand all lines: test/sqllogictest/timedomain.slt
+30-12Lines changed: 30 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -9,14 +9,6 @@
9
9
10
10
mode cockroach
11
11
12
-
# Since mz_now() is a custom function, the postgres client will look it up in the catalog on
13
-
# first use. If the first use happens to be in a transaction, then we can get unexpected time
14
-
# domain errors. This is an annoying hack to load the information in the postgres client before
15
-
# we start any transactions.
16
-
query T rowsort
17
-
SELECT mz_now() LIMIT 0
18
-
----
19
-
20
12
statement ok
21
13
CREATE TABLE t (i INT);
22
14
@@ -74,8 +66,7 @@ SELECT * FROM t;
74
66
statement ok
75
67
ROLLBACK
76
68
77
-
# Test that user table and system tables cannot be mixed in a transaction because they
78
-
# belong to different timedomains.
69
+
# Test that user table and system tables can be mixed in a transaction.
79
70
80
71
statement ok
81
72
BEGIN;
@@ -84,11 +75,11 @@ query I rowsort
84
75
SELECT * FROM t
85
76
----
86
77
87
-
query error Transactions can only reference objects in the same timedomain.
78
+
statement ok
88
79
SELECT * FROM mz_views
89
80
90
81
statement ok
91
-
ROLLBACK
82
+
COMMIT
92
83
93
84
# Test that timeline dependent queries can be included in transaction.
94
85
@@ -173,3 +164,30 @@ SELECT 1 FROM pg_attribute LIMIT 1
173
164
174
165
statement ok
175
166
COMMIT
167
+
168
+
# Verify that system tables are always included in read txns, even if not
169
+
# mentioned in the first query.
170
+
simple
171
+
BEGIN;
172
+
SELECT * FROM t;
173
+
SELECT n.nspname = ANY(current_schemas(true)), n.nspname, t.typname FROM pg_catalog.pg_type t JOIN pg_catalog.pg_namespace n ON t.typnamespace = n.oid WHERE t.oid = 2249;
174
+
COMMIT;
175
+
----
176
+
COMPLETE 0
177
+
COMPLETE 0
178
+
t,pg_catalog,record
179
+
COMPLETE 1
180
+
COMPLETE 0
181
+
182
+
simple
183
+
BEGIN;
184
+
SELECT row(1, 2);
185
+
SELECT n.nspname = ANY(current_schemas(true)), n.nspname, t.typname FROM pg_catalog.pg_type t JOIN pg_catalog.pg_namespace n ON t.typnamespace = n.oid WHERE t.oid = 2249;
0 commit comments