mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-28 09:46:44 +08:00
This patch fixes the param handling in prepared statements for generic plans in ChunkAppend making those params usable in chunk exclusion. Previously those params would not be resolved and therefore not used for chunk exclusion. Fixes #3719
24 lines
902 B
SQL
24 lines
902 B
SQL
-- 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.
|
|
|
|
-- test constraint exclusion with prepared statements and generic plans
|
|
CREATE TABLE i3719 (time timestamptz NOT NULL,data text);
|
|
SELECT table_name FROM create_hypertable('i3719', 'time');
|
|
ALTER TABLE i3719 SET (timescaledb.compress);
|
|
|
|
INSERT INTO i3719 VALUES('2021-01-01 00:00:00', 'chunk 1');
|
|
SELECT count(compress_chunk(c)) FROM show_chunks('i3719') c;
|
|
INSERT INTO i3719 VALUES('2021-02-22 08:00:00', 'chunk 2');
|
|
|
|
SET plan_cache_mode TO force_generic_plan;
|
|
PREPARE p1(timestamptz) AS UPDATE i3719 SET data = 'x' WHERE time=$1;
|
|
PREPARE p2(timestamptz) AS DELETE FROM i3719 WHERE time=$1;
|
|
EXECUTE p1('2021-02-22T08:00:00+00');
|
|
EXECUTE p2('2021-02-22T08:00:00+00');
|
|
|
|
DEALLOCATE p1;
|
|
DEALLOCATE p2;
|
|
|
|
DROP TABLE i3719;
|