postgresql materialized views #123

This commit is contained in:
Jan Prochazka
2021-05-28 22:18:06 +02:00
parent 94804957e5
commit 0a06ebf9c3
16 changed files with 187 additions and 18 deletions

View File

@@ -32,7 +32,7 @@ describe('Object analyse', () => {
const structure = await driver.analyseFull(conn);
expect(structure[type].length).toEqual(1);
expect(structure[type][0]).toEqual(type == 'views' ? view1Match : obj1Match);
expect(structure[type][0]).toEqual(type.includes('views') ? view1Match : obj1Match);
})
);
@@ -47,7 +47,7 @@ describe('Object analyse', () => {
const structure2 = await driver.analyseIncremental(conn, structure1);
expect(structure2[type].length).toEqual(2);
expect(structure2[type].find(x => x.pureName == 'obj1')).toEqual(type == 'views' ? view1Match : obj1Match);
expect(structure2[type].find(x => x.pureName == 'obj1')).toEqual(type.includes('views') ? view1Match : obj1Match);
})
);
@@ -63,7 +63,7 @@ describe('Object analyse', () => {
const structure2 = await driver.analyseIncremental(conn, structure1);
expect(structure2[type].length).toEqual(1);
expect(structure2[type][0]).toEqual(type == 'views' ? view1Match : obj1Match);
expect(structure2[type][0]).toEqual(type.includes('views') ? view1Match : obj1Match);
})
);
@@ -83,7 +83,7 @@ describe('Object analyse', () => {
const structure3 = await driver.analyseIncremental(conn, structure2);
expect(structure3[type].length).toEqual(1);
expect(structure3[type][0]).toEqual(type == 'views' ? view1Match : obj1Match);
expect(structure3[type][0]).toEqual(type.includes('views') ? view1Match : obj1Match);
})
);
});

View File

@@ -5,6 +5,13 @@ const views = {
drop1: 'DROP VIEW obj1',
drop2: 'DROP VIEW obj2',
};
const matviews = {
type: 'matviews',
create1: 'CREATE MATERIALIZED VIEW obj1 AS SELECT id FROM t1',
create2: 'CREATE MATERIALIZED VIEW obj2 AS SELECT id FROM t2',
drop1: 'DROP MATERIALIZED VIEW obj1',
drop2: 'DROP MATERIALIZED VIEW obj2',
};
const engines = [
{
@@ -39,6 +46,7 @@ const engines = [
},
objects: [
views,
matviews,
{
type: 'procedures',
create1: 'CREATE PROCEDURE obj1() LANGUAGE SQL AS $$ select * from t1 $$',