Add Reverse Engineered and Modified SQL tests for Materialized Views. Fixes #4696.

This commit is contained in:
Rahul Shirsat
2019-11-25 11:11:09 +05:30
committed by Akshay Joshi
parent a03b8b4f76
commit 1a39dedc62
85 changed files with 1878 additions and 282 deletions

View File

@@ -10,14 +10,13 @@ CREATE MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }}
{% if(data.fillfactor or data['vacuum_data']|length > 0) %}
WITH (
{% if data.fillfactor %}
FILLFACTOR = {{ data.fillfactor }}{% if data['autovacuum_enabled'] or data['toast_autovacuum_enabled'] or data['vacuum_data']|length > 0 %},{{ '\r' }}{% endif %}
FILLFACTOR = {{ data.fillfactor }}{% if data['autovacuum_enabled'] or data['toast_autovacuum_enabled'] or data['vacuum_data']|length > 0 %},{{ '\n' }}{% endif %}
{% endif %}
{% for field in data['vacuum_data'] %}
{% if field.value is defined and field.value != '' and field.value != none %}
{% if loop.index > 1 %},
{% endif %} {{ field.name }} = {{ field.value|lower }}{% endif %}
{% endfor %}{{ '\r' }}
)
{% endif %} {{ field.name }} = {{ field.value|lower }}{% endif %}{% endfor %}
{{ '\n' }})
{% endif %}
{% if data.spcname %}TABLESPACE {{ data.spcname }}
{% endif %}AS

View File

@@ -10,14 +10,13 @@ CREATE MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }}
{% if(data.fillfactor or data['vacuum_data']|length > 0) %}
WITH (
{% if data.fillfactor %}
FILLFACTOR = {{ data.fillfactor }}{% if data['autovacuum_enabled'] or data['toast_autovacuum_enabled'] or data['vacuum_data']|length > 0 %},{{ '\r' }}{% endif %}
FILLFACTOR = {{ data.fillfactor }}{% if data['autovacuum_enabled'] or data['toast_autovacuum_enabled'] or data['vacuum_data']|length > 0 %},{{ '\n' }}{% endif %}
{% endif %}
{% for field in data['vacuum_data'] %}
{% if field.value is defined and field.value != '' and field.value != none %}
{% if loop.index > 1 %},
{% endif %} {{ field.name }} = {{ field.value|lower }}{% endif %}
{% endfor %}{{ '\r' }}
)
{% endif %} {{ field.name }} = {{ field.value|lower }}{% endif %}{% endfor %}
{{ '\n' }})
{% endif %}
{% if data.spcname %}TABLESPACE {{ data.spcname }}
{% endif %}AS

View File

@@ -29,12 +29,9 @@ DROP MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }};
CREATE MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% if data.fillfactor or (data['vacuum_data']['changed']|length > 0 ) %}
WITH(
{% if data.fillfactor %}
FILLFACTOR = {{ data.fillfactor }}{% if data['vacuum_data']['changed']|length > 0 %},{% endif %}{{ '\r' }}
{% endif %}
{% if data.fillfactor %} FILLFACTOR = {{ data.fillfactor }}{% if data['vacuum_data']['changed']|length > 0 %},{% endif %}{{ '\n' }} {% endif %}
{% if data['vacuum_data']['changed']|length > 0 %}
{% for field in data['vacuum_data']['changed'] %}
{{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
{% for field in data['vacuum_data']['changed'] %} {{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{{ '\n' }}{% endif %}
{% endfor %}
{% endif %}
)
@@ -96,8 +93,7 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
{% if('vacuum_toast' in data and data['vacuum_toast']['changed']|length > 0) %}
ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
{% for field in data['vacuum_toast']['changed'] %}
{% if field.value != None %}
{{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
{% if field.value != None %} {{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{{ '\n' }}{% endif %}
{% endif %}
{% endfor %}
);
@@ -124,9 +120,7 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
{% if('vacuum_table' in data and data['vacuum_table']['changed']|length > 0) %}
ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
{% for field in data['vacuum_table']['changed'] %}
{% if field.value != None %}
{{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
{% endif %}
{% if field.value != None %} {{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{% endif %}
{% endfor %}
);
@@ -138,8 +132,7 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
{% if data['vacuum_data']['reset']|length == 0 and
data['vacuum_data']['changed']|length == 0 and data['settings']|length > 0 %}
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} SET(
{% for field in data['settings'] %}
{{ field }} = {{ data['settings'][field]|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
{% for field in data['settings'] %} {{ field }} = {{ data['settings'][field]|lower }}{% if not loop.last %},{{ '\n' }}{% endif %}
{% endfor %}
);
@@ -147,17 +140,13 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} SET(
{% if(data['vacuum_data']['changed']|length > 0) %}
ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
{% for field in data['vacuum_data']['changed'] %}
{% if field.value != None %}
{{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
{% endif %}
{% if field.value != None %} {{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\n' }}{% endif %}
{% endfor %}
);
{% endif %}
{% if data['vacuum_data']['reset']|length > 0 %}
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
{% for field in data['vacuum_data']['reset'] %}
{{ field.name }}{% if not loop.last %},{% endif %}{{ '\r' }}
{% endfor %}
{% for field in data['vacuum_data']['reset'] %} {{ field.name }}{% if not loop.last %},{% endif %}{{ '\n' }}{% endfor %}
);
{% endif %}
{% endif %}{# ===== End check for custom autovacuum ===== #}

View File

@@ -38,4 +38,5 @@ LEFT JOIN pg_catalog.pg_roles gt ON (d.grantee = gt.oid)
GROUP BY
g.rolname,
gt.rolname
ORDER BY grantee
{% endif %}

View File

@@ -10,14 +10,13 @@ CREATE MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }}
{% if(data.fillfactor or data['vacuum_data']|length > 0) %}
WITH (
{% if data.fillfactor %}
FILLFACTOR = {{ data.fillfactor }}{% if data['autovacuum_enabled'] or data['toast_autovacuum_enabled'] or data['vacuum_data']|length > 0 %},{{ '\r' }}{% endif %}
FILLFACTOR = {{ data.fillfactor }}{% if data['autovacuum_enabled'] or data['toast_autovacuum_enabled'] or data['vacuum_data']|length > 0 %},{{ '\n' }}{% endif %}
{% endif %}
{% for field in data['vacuum_data'] %}
{% if field.value is defined and field.value != '' and field.value != none %}
{% if loop.index > 1 %},
{% endif %} {{ field.name }} = {{ field.value|lower }}{% endif %}
{% endfor %}{{ '\r' }}
)
{% endif %} {{ field.name }} = {{ field.value|lower }}{% endif %}{% endfor %}
{{ '\n' }})
{% endif %}
{% if data.spcname %}TABLESPACE {{ data.spcname }}
{% endif %}AS

View File

@@ -30,11 +30,10 @@ CREATE MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }}
{% if data.fillfactor or (data['vacuum_data']['changed']|length > 0 ) %}
WITH(
{% if data.fillfactor %}
FILLFACTOR = {{ data.fillfactor }}{% if data['vacuum_data']['changed']|length > 0 %},{% endif %}{{ '\r' }}
FILLFACTOR = {{ data.fillfactor }}{% if data['vacuum_data']['changed']|length > 0 %},{% endif %}{{ '\n' }}
{% endif %}
{% if data['vacuum_data']['changed']|length > 0 %}
{% for field in data['vacuum_data']['changed'] %}
{{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
{% for field in data['vacuum_data']['changed'] %} {{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\n' }}
{% endfor %}
{% endif %}
)
@@ -96,8 +95,7 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
{% if('vacuum_toast' in data and data['vacuum_toast']['changed']|length > 0) %}
ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
{% for field in data['vacuum_toast']['changed'] %}
{% if field.value != None %}
{{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
{% if field.value != None %} {{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{{ '\n' }}{% endif %}
{% endif %}
{% endfor %}
);
@@ -124,8 +122,7 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
{% if('vacuum_table' in data and data['vacuum_table']['changed']|length > 0) %}
ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
{% for field in data['vacuum_table']['changed'] %}
{% if field.value != None %}
{{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
{% if field.value != None %} {{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}
{% endif %}
{% endfor %}
);
@@ -138,8 +135,7 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
{% if data['vacuum_data']['reset']|length == 0 and
data['vacuum_data']['changed']|length == 0 and data['settings']|length > 0 %}
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} SET(
{% for field in data['settings'] %}
{{ field }} = {{ data['settings'][field]|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
{% for field in data['settings'] %} {{ field }} = {{ data['settings'][field]|lower }}{% if not loop.last %},{{ '\n' }}{% endif %}
{% endfor %}
);
@@ -147,17 +143,13 @@ ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} SET(
{% if(data['vacuum_data']['changed']|length > 0) %}
ALTER MATERIALIZED VIEW {{ conn|qtIdent(data.schema, data.name) }} SET(
{% for field in data['vacuum_data']['changed'] %}
{% if field.value != None %}
{{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\r' }}
{% endif %}
{% if field.value != None %} {{ field.name }} = {{ field.value|lower }}{% if not loop.last %},{% endif %}{{ '\n' }}{% endif %}
{% endfor %}
);
{% endif %}
{% if data['vacuum_data']['reset']|length > 0 %}
ALTER MATERIALIZED VIEW {{ conn|qtIdent(view_schema, view_name) }} RESET(
{% for field in data['vacuum_data']['reset'] %}
{{ field.name }}{% if not loop.last %},{% endif %}{{ '\r' }}
{% endfor %}
{% for field in data['vacuum_data']['reset'] %} {{ field.name }}{% if not loop.last %},{% endif %}{{ '\n' }}{% endfor %}
);
{% endif %}
{% endif %}{# ===== End check for custom autovacuum ===== #}

View File

@@ -36,4 +36,5 @@ LEFT JOIN pg_catalog.pg_roles gt ON (d.grantee = gt.oid)
GROUP BY
g.rolname,
gt.rolname
ORDER BY grantee
{% endif %}

View File

@@ -1,13 +1,18 @@
-- View: public."testmview_$%{}[]()&*^!@""'`\/#"
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!@""'`\/#";
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!@""'`\/#"
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT test_mview_table.col1
FROM test_mview_table
WITH DATA;
SELECT 1
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!@""'`\/#"
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO postgres;
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
IS 'comment1';
GRANT ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" TO postgres;
GRANT ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" TO PUBLIC;

View File

@@ -0,0 +1,16 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
WITH (
FILLFACTOR = 18,
autovacuum_enabled = false
)
TABLESPACE pg_default
AS
SELECT 12
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO postgres;

View File

@@ -0,0 +1,6 @@
ALTER MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
SET(
FILLFACTOR = 18
);
REFRESH MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#" WITH NO DATA;

View File

@@ -0,0 +1,17 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
WITH (
FILLFACTOR = 18,
autovacuum_analyze_scale_factor = 0.2,
autovacuum_enabled = true
)
TABLESPACE pg_default
AS
SELECT 12
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO postgres;

View File

@@ -0,0 +1,4 @@
ALTER MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#" SET(
autovacuum_analyze_scale_factor = 0.2,
autovacuum_enabled = true
);

View File

@@ -0,0 +1,12 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT 12
WITH DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO postgres;

View File

@@ -0,0 +1,4 @@
DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
AS
SELECT 12

View File

@@ -0,0 +1,17 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT 1
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO postgres;
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
IS 'comment1';
GRANT ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" TO postgres;

View File

@@ -0,0 +1 @@
REVOKE ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" FROM PUBLIC;

View File

@@ -0,0 +1 @@
GRANT ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" TO PUBLIC;

View File

@@ -0,0 +1,16 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
WITH (
FILLFACTOR = 18,
autovacuum_enabled = false
)
TABLESPACE pg_default
AS
SELECT 12
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO postgres;

View File

@@ -0,0 +1,6 @@
ALTER MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#" SET(
autovacuum_enabled = false
);
ALTER MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#" RESET(
autovacuum_analyze_scale_factor
);

View File

@@ -16,5 +16,3 @@ COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO postgres;

View File

@@ -0,0 +1,19 @@
-- View: public."testview_$%{}[]()&*^!@""'`\/#"
-- DROP VIEW public."testview_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=cascaded,
security_barrier=true
) AS
SELECT test_view_table.col1
FROM test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO postgres;
GRANT SELECT, UPDATE, DELETE ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@@ -0,0 +1 @@
GRANT SELECT, UPDATE, DELETE ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@@ -0,0 +1,18 @@
-- View: public."testview_$%{}[]()&*^!@""'`\/#"
-- DROP VIEW public."testview_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=cascaded,
security_barrier=true
) AS
SELECT test_view_table.col1
FROM test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO postgres;

View File

@@ -0,0 +1,4 @@
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (check_option=cascaded, security_barrier=true)
AS
SELECT * FROM test_view_table;

View File

@@ -0,0 +1,18 @@
-- View: public."testview_$%{}[]()&*^!@""'`\/#"
-- DROP VIEW public."testview_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=cascaded,
security_barrier=true
) AS
SELECT test_view_table.col1
FROM test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO postgres;

View File

@@ -0,0 +1 @@
REVOKE ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" FROM PUBLIC;

View File

@@ -0,0 +1,7 @@
ALTER VIEW public."testview_$%{}[]()&*^!@""'`\/#"
SET (security_barrier=true);
ALTER VIEW public."testview_$%{}[]()&*^!@""'`\/#"
SET (check_option=cascaded);
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';

View File

@@ -1,17 +1,15 @@
-- View: public."testmview_$%{}[]()&*^!@""'`\/#"
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!@""'`\/#";
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!@""'`\/#"
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT test_mview_table.col1
FROM test_mview_table
SELECT 1
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!@""'`\/#"
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO postgres;
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment';
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
IS 'comment1';

View File

@@ -0,0 +1,11 @@
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT 1
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO postgres;
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
IS 'comment1';

View File

@@ -0,0 +1,12 @@
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=local
) AS
select col1 from test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO postgres;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment';
GRANT INSERT ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO postgres;

View File

@@ -1,87 +1,256 @@
{
"scenarios": [{
"type": "create",
"name": "Create Table for MViews",
"endpoint": "NODE-table.obj",
"sql_endpoint": "NODE-table.sql_id",
"data": {
"name": "test_mview_table",
"check_constraint": [],
"coll_inherits": "[]",
"columns": [{
"name": "col1",
"cltype": "integer"
}],
"schema": "public"
}
},
{
"type": "create",
"name": "Create MView",
"endpoint": "NODE-mview.obj",
"sql_endpoint": "NODE-mview.sql_id",
"data": {
"definition": "select col1 from test_mview_table;",
"name": "testmview_$%{}[]()&*^!@\"'`\\/#",
"owner": "postgres",
"schema": "public",
"comment": "Testcomment",
"autovacuum_enabled": false,
"datacl": [],
"seclabels": [],
"toast_autovacuum_enabled": false,
"vacuum_table": [{
"name": "autovacuum_analyze_scale_factor"
}],
"vacuum_toast": [{
"name": "autovacuum_freeze_max_age"
}]
},
"expected_sql_file": "create_mview.sql"
},
{
"type": "alter",
"name": "Alter MView",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"data": {
"definition": "select col1 from test_mview_table;",
"name": "testmview_$%{}[]()&*^!@\"'`\\/#",
"owner": "postgres",
"schema": "public",
"comment": "Testcomment",
"autovacuum_enabled": false,
"datacl": [],
"seclabels": [],
"toast_autovacuum_enabled": false,
"vacuum_table": [{
"name": "autovacuum_analyze_scale_factor"
}],
"vacuum_toast": [{
"name": "autovacuum_freeze_max_age"
}]
},
"expected_sql_file": "alter_mview.sql"
},
{
"type": "delete",
"name": "Drop MView",
"endpoint": "NODE-mview.obj_id",
"data": {
"name": "testmview_$%{}[]()&*^!@\"'`\\/#",
"owner": "postgres",
"schema": "public"
}
},
{
"type": "delete",
"name": "Drop Table for mview",
"endpoint": "NODE-table.obj_id",
"data": {
"name": "test_mview_table",
"owner": "postgres",
"schema": "public"
}
}
]
}
"scenarios": [
{
"type": "create",
"name": "Create Materialised Views",
"endpoint": "NODE-mview.obj",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql",
"data": {
"spcname": "pg_default",
"toast_autovacuum_enabled": false,
"autovacuum_enabled": false,
"schema": "public",
"owner": "postgres",
"vacuum_table": [
{
"name": "autovacuum_analyze_scale_factor"
},
{
"name": "autovacuum_analyze_threshold"
},
{
"name": "autovacuum_freeze_max_age"
},
{
"name": "autovacuum_vacuum_cost_delay"
},
{
"name": "autovacuum_vacuum_cost_limit"
},
{
"name": "autovacuum_vacuum_scale_factor"
},
{
"name": "autovacuum_vacuum_threshold"
},
{
"name": "autovacuum_freeze_min_age"
},
{
"name": "autovacuum_freeze_table_age"
}
],
"vacuum_toast": [
{
"name": "autovacuum_freeze_max_age"
},
{
"name": "autovacuum_vacuum_cost_delay"
},
{
"name": "autovacuum_vacuum_cost_limit"
},
{
"name": "autovacuum_vacuum_scale_factor"
},
{
"name": "autovacuum_vacuum_threshold"
},
{
"name": "autovacuum_freeze_min_age"
},
{
"name": "autovacuum_freeze_table_age"
}
],
"datacl": [],
"seclabels": [],
"name": "testmview_$%{}[]()&*^!/@`#",
"comment": "comment1",
"definition": "SELECT 1"
},
"expected_sql_file": "create_mview.sql",
"expected_msql_file": "create_mview_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (Adding privileges)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"datacl": {
"added": [
{
"grantee": "PUBLIC",
"grantor": "postgres",
"privileges": [
{
"privilege_type": "a",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "r",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "w",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "d",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "D",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "x",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "t",
"privilege": true,
"with_grant": false
}
]
}
]
}
},
"expected_sql_file": "alter_mview.sql",
"expected_msql_file": "alter_mview_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (Remove all privileges)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"datacl": {
"deleted": [
{
"grantee": "PUBLIC",
"grantor": "postgres",
"privileges": [
{
"privilege_type": "a",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "r",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "w",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "d",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "D",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "x",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "t",
"privilege": true,
"with_grant": false
}
]
}
]
}
},
"expected_sql_file": "alter_mview_drop_all_priv.sql",
"expected_msql_file": "alter_mview_drop_all_priv_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (change definition)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"definition": "SELECT 12;"
},
"expected_sql_file": "alter_mview_definition.sql",
"expected_msql_file": "alter_mview_definition_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (Fillfactor)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"fillfactor": "18",
"with_data": false
},
"expected_sql_file": "alter_mview_add_fillfactor.sql",
"expected_msql_file": "alter_mview_add_fillfactor_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (add table parameters)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"autovacuum_custom": true,
"autovacuum_enabled": true,
"vacuum_table": {
"changed": [
{
"name": "autovacuum_analyze_scale_factor",
"value": 0.2
}
]
}
},
"expected_sql_file": "alter_mview_add_table_parameter.sql",
"expected_msql_file": "alter_mview_add_table_parameter_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (remove table parameters)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"autovacuum_custom": true,
"autovacuum_enabled": false,
"vacuum_table": {
"changed": [
{
"name": "autovacuum_analyze_scale_factor",
"value": null
}
]
}
},
"expected_sql_file": "alter_mview_remove_table_parameter.sql",
"expected_msql_file": "alter_mview_remove_table_parameter_msql.sql"
}
]
}

View File

@@ -23,6 +23,7 @@
"name": "Create View",
"endpoint": "NODE-view.obj",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql",
"data": {
"definition": "select col1 from test_view_table;",
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
@@ -34,15 +35,16 @@
"datacl":[{"grantee":"postgres", "grantor":"postgres", "privileges":[{"privilege_type": "a", "privilege": true,
"with_grant":false}]}]
},
"expected_sql_file": "create_view.sql"
"expected_sql_file": "create_view.sql",
"expected_msql_file": "create_view_msql.sql"
},
{
"type": "alter",
"name": "Alter View",
"endpoint": "NODE-view.obj_id",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql_id",
"data": {
"definition": "select col1 from test_view_table;",
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "postgres",
"schema": "public",
@@ -52,7 +54,105 @@
"datacl":[{"grantee":"postgres", "grantor":"postgres", "privileges":[{"privilege_type": "a", "privilege": true,
"with_grant":false}]}]
},
"expected_sql_file": "alter_view.sql"
"expected_sql_file": "alter_view.sql",
"expected_msql_file": "alter_view_msql.sql"
},
{
"type": "alter",
"name": "Alter View (changing code)",
"endpoint": "NODE-view.obj_id",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql_id",
"data": {
"definition": "SELECT * FROM test_view_table;"
},
"expected_sql_file": "alter_view_definition.sql",
"expected_msql_file": "alter_view_definition_msql.sql"
},
{
"type": "alter",
"name": "Alter View (adding privileges)",
"endpoint": "NODE-view.obj_id",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql_id",
"data": {
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "postgres",
"schema": "public",
"check_option": "cascaded",
"security_barrier": true,
"comment":"Testcomment-updated",
"datacl":{
"added":[
{
"grantee":"PUBLIC",
"grantor":"postgres",
"privileges":[
{
"privilege_type":"r",
"privilege":true,
"with_grant":false
},
{
"privilege_type":"w",
"privilege":true,
"with_grant":false
},
{
"privilege_type":"d",
"privilege":true,
"with_grant":false
}
]
}
]
}
},
"expected_sql_file": "alter_view_add_some_priv.sql",
"expected_msql_file": "alter_view_add_some_priv_msql.sql"
},
{
"type": "alter",
"name": "Alter View (deleting privileges)",
"endpoint": "NODE-view.obj_id",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql_id",
"data": {
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "postgres",
"schema": "public",
"check_option": "cascaded",
"security_barrier": true,
"comment":"Testcomment-updated",
"datacl":
{
"deleted":[
{
"grantee":"PUBLIC",
"grantor":"postgres",
"privileges":[
{
"privilege_type":"r",
"privilege":true,
"with_grant":false
},
{
"privilege_type":"w",
"privilege":true,
"with_grant":false
},
{
"privilege_type":"d",
"privilege":true,
"with_grant":false
}
]
}
]
}
},
"expected_sql_file": "alter_view_delete_priv.sql",
"expected_msql_file": "alter_view_delete_priv_msql.sql"
},
{
"type": "delete",

View File

@@ -0,0 +1,18 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT 1
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
IS 'comment1';
GRANT ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" TO PUBLIC;
GRANT ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" TO enterprisedb;

View File

@@ -0,0 +1,16 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
WITH (
FILLFACTOR = 18,
autovacuum_enabled = false
)
TABLESPACE pg_default
AS
SELECT 12
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;

View File

@@ -0,0 +1,6 @@
ALTER MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
SET(
FILLFACTOR = 18
);
REFRESH MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#" WITH NO DATA;

View File

@@ -0,0 +1,17 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
WITH (
FILLFACTOR = 18,
autovacuum_analyze_scale_factor = 0.2,
autovacuum_enabled = true
)
TABLESPACE pg_default
AS
SELECT 12
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;

View File

@@ -0,0 +1,4 @@
ALTER MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#" SET(
autovacuum_analyze_scale_factor = 0.2,
autovacuum_enabled = true
);

View File

@@ -0,0 +1,12 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT 12
WITH DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;

View File

@@ -0,0 +1,4 @@
DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
AS
SELECT 12

View File

@@ -0,0 +1,17 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT 1
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
IS 'comment1';
GRANT ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" TO enterprisedb;

View File

@@ -0,0 +1 @@
REVOKE ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" FROM PUBLIC;

View File

@@ -0,0 +1 @@
GRANT ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" TO PUBLIC;

View File

@@ -0,0 +1,16 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
WITH (
FILLFACTOR = 18,
autovacuum_enabled = false
)
TABLESPACE pg_default
AS
SELECT 12
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;

View File

@@ -0,0 +1,6 @@
ALTER MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#" SET(
autovacuum_enabled = false
);
ALTER MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#" RESET(
autovacuum_analyze_scale_factor
);

View File

@@ -0,0 +1,18 @@
-- View: public."testview_$%{}[]()&*^!@""'`\/#"
-- DROP VIEW public."testview_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=cascaded,
security_barrier=true
) AS
SELECT test_view_table.col1
FROM test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1,19 @@
-- View: public."testview_$%{}[]()&*^!@""'`\/#"
-- DROP VIEW public."testview_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=cascaded,
security_barrier=true
) AS
SELECT test_view_table.col1
FROM test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';
GRANT DELETE, UPDATE, SELECT ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO PUBLIC;
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1 @@
GRANT SELECT, UPDATE, DELETE ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@@ -0,0 +1,18 @@
-- View: public."testview_$%{}[]()&*^!@""'`\/#"
-- DROP VIEW public."testview_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=cascaded,
security_barrier=true
) AS
SELECT test_view_table.col1
FROM test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1,4 @@
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (check_option=cascaded, security_barrier=true)
AS
SELECT * FROM test_view_table;

View File

@@ -0,0 +1,18 @@
-- View: public."testview_$%{}[]()&*^!@""'`\/#"
-- DROP VIEW public."testview_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=cascaded,
security_barrier=true
) AS
SELECT test_view_table.col1
FROM test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1 @@
REVOKE ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" FROM PUBLIC;

View File

@@ -0,0 +1,7 @@
ALTER VIEW public."testview_$%{}[]()&*^!@""'`\/#"
SET (security_barrier=true);
ALTER VIEW public."testview_$%{}[]()&*^!@""'`\/#"
SET (check_option=cascaded);
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';

View File

@@ -0,0 +1,15 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT 1
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
IS 'comment1';

View File

@@ -0,0 +1,11 @@
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT 1
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
IS 'comment1';

View File

@@ -0,0 +1,17 @@
-- View: public."testview_$%{}[]()&*^!@""'`\/#"
-- DROP VIEW public."testview_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=local
) AS
SELECT test_view_table.col1
FROM test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment';
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1,12 @@
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=local
) AS
select col1 from test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment';
GRANT INSERT ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1,256 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Materialised Views",
"endpoint": "NODE-mview.obj",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql",
"data": {
"spcname": "pg_default",
"toast_autovacuum_enabled": false,
"autovacuum_enabled": false,
"schema": "public",
"owner": "enterprisedb",
"vacuum_table": [
{
"name": "autovacuum_analyze_scale_factor"
},
{
"name": "autovacuum_analyze_threshold"
},
{
"name": "autovacuum_freeze_max_age"
},
{
"name": "autovacuum_vacuum_cost_delay"
},
{
"name": "autovacuum_vacuum_cost_limit"
},
{
"name": "autovacuum_vacuum_scale_factor"
},
{
"name": "autovacuum_vacuum_threshold"
},
{
"name": "autovacuum_freeze_min_age"
},
{
"name": "autovacuum_freeze_table_age"
}
],
"vacuum_toast": [
{
"name": "autovacuum_freeze_max_age"
},
{
"name": "autovacuum_vacuum_cost_delay"
},
{
"name": "autovacuum_vacuum_cost_limit"
},
{
"name": "autovacuum_vacuum_scale_factor"
},
{
"name": "autovacuum_vacuum_threshold"
},
{
"name": "autovacuum_freeze_min_age"
},
{
"name": "autovacuum_freeze_table_age"
}
],
"datacl": [],
"seclabels": [],
"name": "testmview_$%{}[]()&*^!/@`#",
"comment": "comment1",
"definition": "SELECT 1"
},
"expected_sql_file": "create_mview.sql",
"expected_msql_file": "create_mview_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (Adding privileges)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"datacl": {
"added": [
{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [
{
"privilege_type": "a",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "r",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "w",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "d",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "D",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "x",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "t",
"privilege": true,
"with_grant": false
}
]
}
]
}
},
"expected_sql_file": "alter_mview.sql",
"expected_msql_file": "alter_mview_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (Remove all privileges)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"datacl": {
"deleted": [
{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [
{
"privilege_type": "a",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "r",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "w",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "d",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "D",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "x",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "t",
"privilege": true,
"with_grant": false
}
]
}
]
}
},
"expected_sql_file": "alter_mview_drop_all_priv.sql",
"expected_msql_file": "alter_mview_drop_all_priv_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (change definition)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"definition": "SELECT 12;"
},
"expected_sql_file": "alter_mview_definition.sql",
"expected_msql_file": "alter_mview_definition_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (Fillfactor)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"fillfactor": "18",
"with_data": false
},
"expected_sql_file": "alter_mview_add_fillfactor.sql",
"expected_msql_file": "alter_mview_add_fillfactor_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (add table parameters)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"autovacuum_custom": true,
"autovacuum_enabled": true,
"vacuum_table": {
"changed": [
{
"name": "autovacuum_analyze_scale_factor",
"value": 0.2
}
]
}
},
"expected_sql_file": "alter_mview_add_table_parameter.sql",
"expected_msql_file": "alter_mview_add_table_parameter_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (remove table parameters)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"autovacuum_custom": true,
"autovacuum_enabled": false,
"vacuum_table": {
"changed": [
{
"name": "autovacuum_analyze_scale_factor",
"value": null
}
]
}
},
"expected_sql_file": "alter_mview_remove_table_parameter.sql",
"expected_msql_file": "alter_mview_remove_table_parameter_msql.sql"
}
]
}

View File

@@ -0,0 +1,178 @@
{
"scenarios": [
{
"type": "create",
"name": "Create Table for Views",
"endpoint": "NODE-table.obj",
"sql_endpoint": "NODE-table.sql_id",
"data": {
"name": "test_view_table",
"check_constraint": [],
"coll_inherits": "[]",
"columns": [
{
"name": "col1",
"cltype": "integer"
}
],
"schema": "public"
}
},
{
"type": "create",
"name": "Create View",
"endpoint": "NODE-view.obj",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql",
"data": {
"definition": "select col1 from test_view_table;",
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public",
"check_option": "local",
"security_barrier": false,
"comment":"Testcomment",
"datacl":[{"grantee":"enterprisedb", "grantor":"enterprisedb", "privileges":[{"privilege_type": "a", "privilege": true,
"with_grant":false}]}]
},
"expected_sql_file": "create_view.sql",
"expected_msql_file": "create_view_msql.sql"
},
{
"type": "alter",
"name": "Alter View",
"endpoint": "NODE-view.obj_id",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql_id",
"data": {
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public",
"check_option": "cascaded",
"security_barrier": true,
"comment":"Testcomment-updated",
"datacl":[{"grantee":"enterprisedb", "grantor":"enterprisedb", "privileges":[{"privilege_type": "a", "privilege": true,
"with_grant":false}]}]
},
"expected_sql_file": "alter_view.sql",
"expected_msql_file": "alter_view_msql.sql"
},
{
"type": "alter",
"name": "Alter View (changing code)",
"endpoint": "NODE-view.obj_id",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql_id",
"data": {
"definition": "SELECT * FROM test_view_table;"
},
"expected_sql_file": "alter_view_definition.sql",
"expected_msql_file": "alter_view_definition_msql.sql"
},
{
"type": "alter",
"name": "Alter View (adding privileges)",
"endpoint": "NODE-view.obj_id",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql_id",
"data": {
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public",
"check_option": "cascaded",
"security_barrier": true,
"comment":"Testcomment-updated",
"datacl":{
"added":[
{
"grantee":"PUBLIC",
"grantor":"enterprisedb",
"privileges":[
{
"privilege_type":"r",
"privilege":true,
"with_grant":false
},
{
"privilege_type":"w",
"privilege":true,
"with_grant":false
},
{
"privilege_type":"d",
"privilege":true,
"with_grant":false
}
]
}
]
}
},
"expected_sql_file": "alter_view_add_some_priv.sql",
"expected_msql_file": "alter_view_add_some_priv_msql.sql"
},
{
"type": "alter",
"name": "Alter View (deleting privileges)",
"endpoint": "NODE-view.obj_id",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql_id",
"data": {
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public",
"check_option": "cascaded",
"security_barrier": true,
"comment":"Testcomment-updated",
"datacl":
{
"deleted":[
{
"grantee":"PUBLIC",
"grantor":"enterprisedb",
"privileges":[
{
"privilege_type":"r",
"privilege":true,
"with_grant":false
},
{
"privilege_type":"w",
"privilege":true,
"with_grant":false
},
{
"privilege_type":"d",
"privilege":true,
"with_grant":false
}
]
}
]
}
},
"expected_sql_file": "alter_view_delete_priv.sql",
"expected_msql_file": "alter_view_delete_priv_msql.sql"
},
{
"type": "delete",
"name": "Drop View",
"endpoint": "NODE-view.obj_id",
"data": {
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public"
}
},
{
"type": "delete",
"name": "Drop Table for view",
"endpoint": "NODE-table.obj_id",
"data": {
"name": "test_view_table",
"owner": "enterprisedb",
"schema": "public"
}
}
]
}

View File

@@ -1,13 +1,18 @@
-- View: public."testmview_$%{}[]()&*^!@""'`\/#"
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!@""'`\/#";
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!@""'`\/#"
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT test_mview_table.col1
FROM test_mview_table
WITH DATA;
SELECT 1
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!@""'`\/#"
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
IS 'comment1';
GRANT ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" TO PUBLIC;
GRANT ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" TO enterprisedb;

View File

@@ -0,0 +1,16 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
WITH (
FILLFACTOR = 18,
autovacuum_enabled = false
)
TABLESPACE pg_default
AS
SELECT 12
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;

View File

@@ -0,0 +1,6 @@
ALTER MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
SET(
FILLFACTOR = 18
);
REFRESH MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#" WITH NO DATA;

View File

@@ -0,0 +1,17 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
WITH (
FILLFACTOR = 18,
autovacuum_analyze_scale_factor = 0.2,
autovacuum_enabled = true
)
TABLESPACE pg_default
AS
SELECT 12
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;

View File

@@ -0,0 +1,4 @@
ALTER MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#" SET(
autovacuum_analyze_scale_factor = 0.2,
autovacuum_enabled = true
);

View File

@@ -0,0 +1,12 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT 12
WITH DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;

View File

@@ -0,0 +1,4 @@
DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
AS
SELECT 12

View File

@@ -0,0 +1,17 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT 1
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
IS 'comment1';
GRANT ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" TO enterprisedb;

View File

@@ -0,0 +1 @@
REVOKE ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" FROM PUBLIC;

View File

@@ -0,0 +1 @@
GRANT ALL ON TABLE public."testmview_$%{}[]()&*^!/@`#" TO PUBLIC;

View File

@@ -0,0 +1,16 @@
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
WITH (
FILLFACTOR = 18,
autovacuum_enabled = false
)
TABLESPACE pg_default
AS
SELECT 12
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;

View File

@@ -0,0 +1,6 @@
ALTER MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#" SET(
autovacuum_enabled = false
);
ALTER MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#" RESET(
autovacuum_analyze_scale_factor
);

View File

@@ -1,8 +1,8 @@
-- View: public."testview1_$%{}[]()&*^!@""'`\/#"
-- View: public."testview_$%{}[]()&*^!@""'`\/#"
-- DROP VIEW public."testview1_$%{}[]()&*^!@""'`\/#";
-- DROP VIEW public."testview_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE VIEW public."testview1_$%{}[]()&*^!@""'`\/#"
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=cascaded,
security_barrier=true
@@ -10,9 +10,9 @@ WITH (
SELECT test_view_table.col1
FROM test_view_table;
ALTER TABLE public."testview1_$%{}[]()&*^!@""'`\/#"
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON VIEW public."testview1_$%{}[]()&*^!@""'`\/#"
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';
GRANT ALL ON TABLE public."testview1_$%{}[]()&*^!@""'`\/#" TO enterprisedb;
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1,19 @@
-- View: public."testview_$%{}[]()&*^!@""'`\/#"
-- DROP VIEW public."testview_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=cascaded,
security_barrier=true
) AS
SELECT test_view_table.col1
FROM test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';
GRANT SELECT, UPDATE, DELETE ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO PUBLIC;
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1 @@
GRANT SELECT, UPDATE, DELETE ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO PUBLIC;

View File

@@ -0,0 +1,18 @@
-- View: public."testview_$%{}[]()&*^!@""'`\/#"
-- DROP VIEW public."testview_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=cascaded,
security_barrier=true
) AS
SELECT test_view_table.col1
FROM test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1,4 @@
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (check_option=cascaded, security_barrier=true)
AS
SELECT * FROM test_view_table;

View File

@@ -0,0 +1,18 @@
-- View: public."testview_$%{}[]()&*^!@""'`\/#"
-- DROP VIEW public."testview_$%{}[]()&*^!@""'`\/#";
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=cascaded,
security_barrier=true
) AS
SELECT test_view_table.col1
FROM test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1 @@
REVOKE ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" FROM PUBLIC;

View File

@@ -0,0 +1,7 @@
ALTER VIEW public."testview_$%{}[]()&*^!@""'`\/#"
SET (security_barrier=true);
ALTER VIEW public."testview_$%{}[]()&*^!@""'`\/#"
SET (check_option=cascaded);
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment-updated';

View File

@@ -1,17 +1,15 @@
-- View: public."testmview_$%{}[]()&*^!@""'`\/#"
-- View: public."testmview_$%{}[]()&*^!/@`#"
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!@""'`\/#";
-- DROP MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#";
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!@""'`\/#"
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT test_mview_table.col1
FROM test_mview_table
SELECT 1
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!@""'`\/#"
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment';
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
IS 'comment1';

View File

@@ -0,0 +1,11 @@
CREATE MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
TABLESPACE pg_default
AS
SELECT 1
WITH NO DATA;
ALTER TABLE public."testmview_$%{}[]()&*^!/@`#"
OWNER TO enterprisedb;
COMMENT ON MATERIALIZED VIEW public."testmview_$%{}[]()&*^!/@`#"
IS 'comment1';

View File

@@ -15,7 +15,3 @@ COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment';
GRANT ALL ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -0,0 +1,12 @@
CREATE OR REPLACE VIEW public."testview_$%{}[]()&*^!@""'`\/#"
WITH (
check_option=local
) AS
select col1 from test_view_table;
ALTER TABLE public."testview_$%{}[]()&*^!@""'`\/#"
OWNER TO enterprisedb;
COMMENT ON VIEW public."testview_$%{}[]()&*^!@""'`\/#"
IS 'Testcomment';
GRANT INSERT ON TABLE public."testview_$%{}[]()&*^!@""'`\/#" TO enterprisedb;

View File

@@ -1,87 +1,256 @@
{
"scenarios": [{
"type": "create",
"name": "Create Table for MViews",
"endpoint": "NODE-table.obj",
"sql_endpoint": "NODE-table.sql_id",
"data": {
"name": "test_mview_table",
"check_constraint": [],
"coll_inherits": "[]",
"columns": [{
"name": "col1",
"cltype": "integer"
}],
"schema": "public"
}
},
{
"type": "create",
"name": "Create MView",
"endpoint": "NODE-mview.obj",
"sql_endpoint": "NODE-mview.sql_id",
"data": {
"definition": "select col1 from test_mview_table;",
"name": "testmview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public",
"comment": "Testcomment",
"autovacuum_enabled": false,
"datacl": [],
"seclabels": [],
"toast_autovacuum_enabled": false,
"vacuum_table": [{
"name": "autovacuum_analyze_scale_factor"
}],
"vacuum_toast": [{
"name": "autovacuum_freeze_max_age"
}]
},
"expected_sql_file": "create_mview.sql"
},
{
"type": "alter",
"name": "Alter MView",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"data": {
"definition": "select col1 from test_mview_table;",
"name": "testmview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public",
"comment": "Testcomment",
"autovacuum_enabled": false,
"datacl": [],
"seclabels": [],
"toast_autovacuum_enabled": false,
"vacuum_table": [{
"name": "autovacuum_analyze_scale_factor"
}],
"vacuum_toast": [{
"name": "autovacuum_freeze_max_age"
}]
},
"expected_sql_file": "alter_mview.sql"
},
{
"type": "delete",
"name": "Drop MView",
"endpoint": "NODE-mview.obj_id",
"data": {
"name": "testmview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public"
}
},
{
"type": "delete",
"name": "Drop Table for mview",
"endpoint": "NODE-table.obj_id",
"data": {
"name": "test_mview_table",
"owner": "postgres",
"schema": "public"
}
}
]
}
"scenarios": [
{
"type": "create",
"name": "Create Materialised Views",
"endpoint": "NODE-mview.obj",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql",
"data": {
"spcname": "pg_default",
"toast_autovacuum_enabled": false,
"autovacuum_enabled": false,
"schema": "public",
"owner": "enterprisedb",
"vacuum_table": [
{
"name": "autovacuum_analyze_scale_factor"
},
{
"name": "autovacuum_analyze_threshold"
},
{
"name": "autovacuum_freeze_max_age"
},
{
"name": "autovacuum_vacuum_cost_delay"
},
{
"name": "autovacuum_vacuum_cost_limit"
},
{
"name": "autovacuum_vacuum_scale_factor"
},
{
"name": "autovacuum_vacuum_threshold"
},
{
"name": "autovacuum_freeze_min_age"
},
{
"name": "autovacuum_freeze_table_age"
}
],
"vacuum_toast": [
{
"name": "autovacuum_freeze_max_age"
},
{
"name": "autovacuum_vacuum_cost_delay"
},
{
"name": "autovacuum_vacuum_cost_limit"
},
{
"name": "autovacuum_vacuum_scale_factor"
},
{
"name": "autovacuum_vacuum_threshold"
},
{
"name": "autovacuum_freeze_min_age"
},
{
"name": "autovacuum_freeze_table_age"
}
],
"datacl": [],
"seclabels": [],
"name": "testmview_$%{}[]()&*^!/@`#",
"comment": "comment1",
"definition": "SELECT 1"
},
"expected_sql_file": "create_mview.sql",
"expected_msql_file": "create_mview_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (Adding privileges)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"datacl": {
"added": [
{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [
{
"privilege_type": "a",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "r",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "w",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "d",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "D",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "x",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "t",
"privilege": true,
"with_grant": false
}
]
}
]
}
},
"expected_sql_file": "alter_mview.sql",
"expected_msql_file": "alter_mview_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (Remove all privileges)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"datacl": {
"deleted": [
{
"grantee": "PUBLIC",
"grantor": "enterprisedb",
"privileges": [
{
"privilege_type": "a",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "r",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "w",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "d",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "D",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "x",
"privilege": true,
"with_grant": false
},
{
"privilege_type": "t",
"privilege": true,
"with_grant": false
}
]
}
]
}
},
"expected_sql_file": "alter_mview_drop_all_priv.sql",
"expected_msql_file": "alter_mview_drop_all_priv_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (change definition)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"definition": "SELECT 12;"
},
"expected_sql_file": "alter_mview_definition.sql",
"expected_msql_file": "alter_mview_definition_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (Fillfactor)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"fillfactor": "18",
"with_data": false
},
"expected_sql_file": "alter_mview_add_fillfactor.sql",
"expected_msql_file": "alter_mview_add_fillfactor_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (add table parameters)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"autovacuum_custom": true,
"autovacuum_enabled": true,
"vacuum_table": {
"changed": [
{
"name": "autovacuum_analyze_scale_factor",
"value": 0.2
}
]
}
},
"expected_sql_file": "alter_mview_add_table_parameter.sql",
"expected_msql_file": "alter_mview_add_table_parameter_msql.sql"
},
{
"type": "alter",
"name": "Alter Materialised Views (remove table parameters)",
"endpoint": "NODE-mview.obj_id",
"sql_endpoint": "NODE-mview.sql_id",
"msql_endpoint": "NODE-mview.msql_id",
"data": {
"autovacuum_custom": true,
"autovacuum_enabled": false,
"vacuum_table": {
"changed": [
{
"name": "autovacuum_analyze_scale_factor",
"value": null
}
]
}
},
"expected_sql_file": "alter_mview_remove_table_parameter.sql",
"expected_msql_file": "alter_mview_remove_table_parameter_msql.sql"
}
]
}

View File

@@ -1,18 +1,19 @@
{
"scenarios": [{
"scenarios": [
{
"type": "create",
"name": "Create Table for Views",
"endpoint": "NODE-table.obj",
"sql_endpoint": "NODE-table.sql_id",
"data":{
"name":"test_view_table",
"data": {
"name": "test_view_table",
"check_constraint": [],
"coll_inherits": "[]",
"columns": [
{
"name": "col1",
"cltype": "integer"
}
{
"name": "col1",
"cltype": "integer"
}
],
"schema": "public"
}
@@ -22,55 +23,156 @@
"name": "Create View",
"endpoint": "NODE-view.obj",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql",
"data": {
"datacl":[{"grantee":"enterprisedb", "grantor":"enterprisedb", "privileges":[{"privilege_type": "a", "privilege": true, "with_grant":
false}]}],
"definition": "select col1 from test_view_table;",
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public",
"check_option": "local",
"security_barrier": false,
"comment":"Testcomment"
"comment":"Testcomment",
"datacl":[{"grantee":"enterprisedb", "grantor":"enterprisedb", "privileges":[{"privilege_type": "a", "privilege": true,
"with_grant":false}]}]
},
"expected_sql_file": "create_view.sql"
"expected_sql_file": "create_view.sql",
"expected_msql_file": "create_view_msql.sql"
},
{
"type": "alter",
"name": "Alter View",
"endpoint": "NODE-view.obj_id",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql_id",
"data": {
"definition": "select col1 from test_view_table;",
"name": "testview1_$%{}[]()&*^!@\"'`\\/#",
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public",
"check_option": "cascaded",
"security_barrier": true,
"comment":"Testcomment-updated",
"datacl":[{"grantee":"enterprisedb", "grantor":"enterprisedb", "privileges":[{"privilege_type": "a", "privilege": false,
"datacl":[{"grantee":"enterprisedb", "grantor":"enterprisedb", "privileges":[{"privilege_type": "a", "privilege": true,
"with_grant":false}]}]
},
"expected_sql_file": "alter_view.sql"
"expected_sql_file": "alter_view.sql",
"expected_msql_file": "alter_view_msql.sql"
},
{
"type": "alter",
"name": "Alter View (changing code)",
"endpoint": "NODE-view.obj_id",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql_id",
"data": {
"definition": "SELECT * FROM test_view_table;"
},
"expected_sql_file": "alter_view_definition.sql",
"expected_msql_file": "alter_view_definition_msql.sql"
},
{
"type": "alter",
"name": "Alter View (adding privileges)",
"endpoint": "NODE-view.obj_id",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql_id",
"data": {
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public",
"check_option": "cascaded",
"security_barrier": true,
"comment":"Testcomment-updated",
"datacl":{
"added":[
{
"grantee":"PUBLIC",
"grantor":"enterprisedb",
"privileges":[
{
"privilege_type":"r",
"privilege":true,
"with_grant":false
},
{
"privilege_type":"w",
"privilege":true,
"with_grant":false
},
{
"privilege_type":"d",
"privilege":true,
"with_grant":false
}
]
}
]
}
},
"expected_sql_file": "alter_view_add_some_priv.sql",
"expected_msql_file": "alter_view_add_some_priv_msql.sql"
},
{
"type": "alter",
"name": "Alter View (deleting privileges)",
"endpoint": "NODE-view.obj_id",
"sql_endpoint": "NODE-view.sql_id",
"msql_endpoint": "NODE-view.msql_id",
"data": {
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public",
"check_option": "cascaded",
"security_barrier": true,
"comment":"Testcomment-updated",
"datacl":
{
"deleted":[
{
"grantee":"PUBLIC",
"grantor":"enterprisedb",
"privileges":[
{
"privilege_type":"r",
"privilege":true,
"with_grant":false
},
{
"privilege_type":"w",
"privilege":true,
"with_grant":false
},
{
"privilege_type":"d",
"privilege":true,
"with_grant":false
}
]
}
]
}
},
"expected_sql_file": "alter_view_delete_priv.sql",
"expected_msql_file": "alter_view_delete_priv_msql.sql"
},
{
"type": "delete",
"name": "Drop View",
"endpoint": "NODE-view.obj_id",
"data": {
"name": "testview1_$%{}[]()&*^!@\"'`\\/#",
"name": "testview_$%{}[]()&*^!@\"'`\\/#",
"owner": "enterprisedb",
"schema": "public"
}
},
{
"type": "delete",
"name": "Drop Table for Views",
"name": "Drop Table for view",
"endpoint": "NODE-table.obj_id",
"data": {
"name": "test_view_table",
"owner": "enterprisedb",
"schema": "public"
}
}]
}
]
}