add materialized view feature to opengauss

This commit is contained in:
sqyyeah
2020-08-17 11:48:18 +08:00
parent 3eade03f9c
commit d5337ceca7
120 changed files with 3796 additions and 823 deletions

View File

@ -681,3 +681,26 @@ SELECT COUNT(*) = 19::bigint AS t FROM try;
SELECT like_escape( name, '' ) = like_escape( name::text, '' ) AS t FROM srt;
SELECT like_escape( name::text, ''::citext ) = like_escape( name::text, '' ) AS t FROM srt;
-- Ensure correct behavior for citext with materialized views.
CREATE TABLE citext_table (
id serial primary key,
name citext
);
INSERT INTO citext_table (name)
VALUES ('one'), ('two'), ('three'), (NULL), (NULL);
CREATE MATERIALIZED VIEW citext_matview AS
SELECT * FROM citext_table;
CREATE UNIQUE INDEX citext_matview_id
ON citext_matview (id);
SELECT *
FROM citext_matview m
FULL JOIN citext_table t ON (t.id = m.id AND t *= m)
WHERE t.id IS NULL OR m.id IS NULL;
UPDATE citext_table SET name = 'Two' WHERE name = 'TWO';
SELECT *
FROM citext_matview m
FULL JOIN citext_table t ON (t.id = m.id AND t *= m)
WHERE t.id IS NULL OR m.id IS NULL;
REFRESH MATERIALIZED VIEW CONCURRENTLY citext_matview;
SELECT * FROM citext_matview ORDER BY id;