-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathcompress_compbloom_naming.out
More file actions
73 lines (70 loc) · 2.23 KB
/
Copy pathcompress_compbloom_naming.out
File metadata and controls
73 lines (70 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
-- Testcase for issue #9578: the composite bloom filter naming
-- allowed to generate the same column name for ('a_b', 'c') and ('a', 'b_c').
CREATE TABLE t (
ts timestamptz NOT NULL,
a_b int,
c int,
a int,
b_c int
);
SELECT create_hypertable('t', 'ts');
create_hypertable
-------------------
(1,public,t,t)
ALTER TABLE t SET (
timescaledb.compress,
timescaledb.compress_orderby = 'ts',
timescaledb.compress_index = 'bloom(a_b, c), bloom(a, b_c)'
);
INSERT INTO t VALUES ('2024-01-01', 1, 2, 3, 4);
SELECT compress_chunk(c) FROM show_chunks('t') c;
compress_chunk
----------------------------------------
_timescaledb_internal._hyper_1_1_chunk
-- If the below error doesn't appear, then the bugfix worked:
-- ERROR: column regress-test-bloom_a_b_c specified more than once
-- Check the bloom column names in the compressed chunk
SELECT
relname,
attname
FROM
pg_attribute a,
pg_class c
WHERE
c.oid=a.attrelid AND
attname LIKE '%_ts_meta%bloom%a_b_c%' AND
relname LIKE '%chunk'
ORDER BY
relname::text COLLATE "C",
attname::text COLLATE "C";
relname | attname
--------------------------+-------------------------------
compress_hyper_2_2_chunk | regress-test-bloom_c66a_a_b_c
compress_hyper_2_2_chunk | regress-test-bloom_ee9c_a_b_c
-- Verify the assumption that the zero byte separator used in the
-- bloom column names is not allowed in Postgres column names:
-- 'a' || chr(0) || 'b' = 'a\u0000b'
\set ON_ERROR_STOP 0
CREATE TABLE t2 (
ts timestamptz NOT NULL,
U&"a\0000b" int,
c int,
a int,
U&"b\0000c" int);
ERROR: invalid Unicode escape value at character 60
CREATE TABLE t3 (
ts timestamptz NOT NULL,
E'a\000b' int,
c int,
a int,
E'b\000c' int);
ERROR: invalid byte sequence for encoding "UTF8": 0x00
DO $$
BEGIN
EXECUTE format('CREATE TABLE t4 (%I int)', E'a\000b');
END $$;
ERROR: invalid byte sequence for encoding "UTF8": 0x00
\set ON_ERROR_STOP 1