mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1) Remove folders that are no longer used for older database versions.
2) Fixed RESQL tests for View/MView.
This commit is contained in:
@@ -26,8 +26,9 @@ Housekeeping
|
|||||||
Bug fixes
|
Bug fixes
|
||||||
*********
|
*********
|
||||||
|
|
||||||
|
| `Issue #5101 <https://github.com/pgadmin-org/pgadmin4/issues/5101>`_ - Ensure consistent orderings for ACLS when comparing schemas in the schema diff.
|
||||||
| `Issue #5145 <https://github.com/pgadmin-org/pgadmin4/issues/5145>`_ - Fixed intermittent error shown while OAuth2 login.
|
| `Issue #5145 <https://github.com/pgadmin-org/pgadmin4/issues/5145>`_ - Fixed intermittent error shown while OAuth2 login.
|
||||||
| `Issue #5167 <https://github.com/pgadmin-org/pgadmin4/issues/5167>`_ - Fixed the .psqlrc issue for PSQL Tool.
|
| `Issue #5167 <https://github.com/pgadmin-org/pgadmin4/issues/5167>`_ - Ensure that the path to the psqlrc file is correct when multiple users open the PSQL tool at the same time.
|
||||||
| `Issue #5188 <https://github.com/pgadmin-org/pgadmin4/issues/5188>`_ - Ensure that the continue/start button should be disabled if the user stops the Debugger for the procedures.
|
| `Issue #5188 <https://github.com/pgadmin-org/pgadmin4/issues/5188>`_ - Ensure that the continue/start button should be disabled if the user stops the Debugger for the procedures.
|
||||||
| `Issue #5210 <https://github.com/pgadmin-org/pgadmin4/issues/5210>`_ - Ensure that the query tool creates a new tab with the appropriate user when pressing Alt+Shift+Q.
|
| `Issue #5210 <https://github.com/pgadmin-org/pgadmin4/issues/5210>`_ - Ensure that the query tool creates a new tab with the appropriate user when pressing Alt+Shift+Q.
|
||||||
| `Issue #5212 <https://github.com/pgadmin-org/pgadmin4/issues/5212>`_ - Added the close button for all the notifications of the notistack.
|
| `Issue #5212 <https://github.com/pgadmin-org/pgadmin4/issues/5212>`_ - Added the close button for all the notifications of the notistack.
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
{% if data and schema and domain %}
|
|
||||||
ALTER DOMAIN {{ conn|qtIdent(schema, domain) }}
|
|
||||||
ADD CONSTRAINT {{ conn|qtIdent(data.name) }} CHECK ({{ data.consrc }}){% if not data.convalidated %}
|
|
||||||
|
|
||||||
NOT VALID{% endif %};{% if data.description %}
|
|
||||||
|
|
||||||
|
|
||||||
COMMENT ON CONSTRAINT {{ conn|qtIdent(data.name) }} ON DOMAIN {{ conn|qtIdent(schema, domain) }}
|
|
||||||
IS '{{ data.description }}';{% endif %}
|
|
||||||
{% endif %}
|
|
@@ -1,5 +0,0 @@
|
|||||||
SELECT
|
|
||||||
typcategory
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_type
|
|
||||||
WHERE typname = {{datatype}};
|
|
@@ -1,22 +0,0 @@
|
|||||||
SELECT
|
|
||||||
c.oid, conname AS name, typname AS relname, nspname, description,
|
|
||||||
pg_catalog.regexp_replace(pg_catalog.pg_get_constraintdef(c.oid, true), E'CHECK \\((.*)\\).*', E'\\1') AS consrc,
|
|
||||||
connoinherit, convalidated, convalidated AS convalidated_p
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_constraint c
|
|
||||||
JOIN
|
|
||||||
pg_catalog.pg_type t ON t.oid=contypid
|
|
||||||
JOIN
|
|
||||||
pg_catalog.pg_namespace nl ON nl.oid=typnamespace
|
|
||||||
LEFT OUTER JOIN
|
|
||||||
pg_catalog.pg_description des ON (des.objoid=c.oid AND des.classoid='pg_constraint'::regclass)
|
|
||||||
{% if doid %}
|
|
||||||
WHERE
|
|
||||||
contype = 'c' AND contypid = {{doid}}::oid
|
|
||||||
{% if coid %}
|
|
||||||
AND c.oid = {{ coid }}
|
|
||||||
{% endif %}
|
|
||||||
{% elif coid %}
|
|
||||||
WHERE
|
|
||||||
c.oid = {{ coid }}
|
|
||||||
{% endif %}
|
|
@@ -1,13 +0,0 @@
|
|||||||
{% set name = o_data.name %}
|
|
||||||
{% if data.name %}
|
|
||||||
{% set name = data.name %}
|
|
||||||
ALTER DOMAIN {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
|
|
||||||
RENAME CONSTRAINT {{ conn|qtIdent(o_data.name) }} TO {{ conn|qtIdent(data.name) }};{% endif -%}{% if data.convalidated %}
|
|
||||||
|
|
||||||
|
|
||||||
ALTER DOMAIN {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
|
|
||||||
VALIDATE CONSTRAINT {{ conn|qtIdent(name) }};{% endif -%}{% if data.description is defined %}
|
|
||||||
|
|
||||||
|
|
||||||
COMMENT ON CONSTRAINT {{ conn|qtIdent(name) }} ON DOMAIN {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
|
|
||||||
IS {{ data.description|qtLiteral }};{% endif %}
|
|
@@ -1,3 +1,10 @@
|
|||||||
{% if data and schema and domain %}
|
{% if data and schema and domain %}
|
||||||
ALTER DOMAIN {{ conn|qtIdent(schema, domain) }}
|
ALTER DOMAIN {{ conn|qtIdent(schema, domain) }}
|
||||||
ADD CONSTRAINT {{ conn|qtIdent(data.name) }} CHECK ({{ data.consrc }});{% endif -%}
|
ADD CONSTRAINT {{ conn|qtIdent(data.name) }} CHECK ({{ data.consrc }}){% if not data.convalidated %}
|
||||||
|
|
||||||
|
NOT VALID{% endif %};{% if data.description %}
|
||||||
|
|
||||||
|
|
||||||
|
COMMENT ON CONSTRAINT {{ conn|qtIdent(data.name) }} ON DOMAIN {{ conn|qtIdent(schema, domain) }}
|
||||||
|
IS '{{ data.description }}';{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
@@ -1,12 +1,15 @@
|
|||||||
SELECT
|
SELECT
|
||||||
c.oid, conname AS name, typname AS relname, nspname,
|
c.oid, conname AS name, typname AS relname, nspname, description,
|
||||||
pg_catalog.regexp_replace(pg_catalog.pg_get_constraintdef(c.oid, true), E'CHECK \\((.*)\\).*', E'\\1') AS consrc
|
pg_catalog.regexp_replace(pg_catalog.pg_get_constraintdef(c.oid, true), E'CHECK \\((.*)\\).*', E'\\1') AS consrc,
|
||||||
|
connoinherit, convalidated, convalidated AS convalidated_p
|
||||||
FROM
|
FROM
|
||||||
pg_catalog.pg_constraint c
|
pg_catalog.pg_constraint c
|
||||||
JOIN
|
JOIN
|
||||||
pg_catalog.pg_type t ON t.oid=contypid
|
pg_catalog.pg_type t ON t.oid=contypid
|
||||||
JOIN
|
JOIN
|
||||||
pg_catalog.pg_namespace nl ON nl.oid=typnamespace
|
pg_catalog.pg_namespace nl ON nl.oid=typnamespace
|
||||||
|
LEFT OUTER JOIN
|
||||||
|
pg_catalog.pg_description des ON (des.objoid=c.oid AND des.classoid='pg_constraint'::regclass)
|
||||||
{% if doid %}
|
{% if doid %}
|
||||||
WHERE
|
WHERE
|
||||||
contype = 'c' AND contypid = {{doid}}::oid
|
contype = 'c' AND contypid = {{doid}}::oid
|
||||||
|
@@ -1,3 +1,13 @@
|
|||||||
|
{% set name = o_data.name %}
|
||||||
{% if data.name %}
|
{% if data.name %}
|
||||||
|
{% set name = data.name %}
|
||||||
ALTER DOMAIN {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
|
ALTER DOMAIN {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
|
||||||
RENAME CONSTRAINT {{ conn|qtIdent(o_data.name) }} TO {{ conn|qtIdent(data.name) }};{% endif %}
|
RENAME CONSTRAINT {{ conn|qtIdent(o_data.name) }} TO {{ conn|qtIdent(data.name) }};{% endif -%}{% if data.convalidated %}
|
||||||
|
|
||||||
|
|
||||||
|
ALTER DOMAIN {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
|
||||||
|
VALIDATE CONSTRAINT {{ conn|qtIdent(name) }};{% endif -%}{% if data.description is defined %}
|
||||||
|
|
||||||
|
|
||||||
|
COMMENT ON CONSTRAINT {{ conn|qtIdent(name) }} ON DOMAIN {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
|
||||||
|
IS {{ data.description|qtLiteral }};{% endif %}
|
||||||
|
@@ -38,10 +38,7 @@ class TestColumnForeignKeyGetConstraintCols(BaseTestGenerator):
|
|||||||
" and pg_attribute.attname = 'some_column'")
|
" and pg_attribute.attname = 'some_column'")
|
||||||
table_id, column_id = cursor.fetchone()
|
table_id, column_id = cursor.fetchone()
|
||||||
|
|
||||||
if connection.server_version < 90100:
|
self.versions_to_test = ['default']
|
||||||
self.versions_to_test = ['default']
|
|
||||||
else:
|
|
||||||
self.versions_to_test = ['9.1_plus']
|
|
||||||
|
|
||||||
for version in self.versions_to_test:
|
for version in self.versions_to_test:
|
||||||
template_file = os.path.join(
|
template_file = os.path.join(
|
||||||
|
@@ -1,26 +0,0 @@
|
|||||||
{# List of allowed privileges for PostgreSQL 9.1 #}
|
|
||||||
{#
|
|
||||||
Format for allowed privileges is:
|
|
||||||
"acl_col": {
|
|
||||||
"type": "name",
|
|
||||||
"acl": [...]
|
|
||||||
}
|
|
||||||
#}
|
|
||||||
{
|
|
||||||
"nspacl": {
|
|
||||||
"type": "DATABASE",
|
|
||||||
"acl": ["c", "C", "T"]
|
|
||||||
},
|
|
||||||
"deftblacl": {
|
|
||||||
"type": "TABLE",
|
|
||||||
"acl": ["r", "a", "w", "d", "D", "x", "t"]
|
|
||||||
},
|
|
||||||
"defseqacl": {
|
|
||||||
"type": "SEQUENCE",
|
|
||||||
"acl": ["U", "r", "w"]
|
|
||||||
},
|
|
||||||
"deffuncacl": {
|
|
||||||
"type": "FUNCTION",
|
|
||||||
"acl": ["X"]
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,24 +0,0 @@
|
|||||||
{# Fetch privileges for schema #}
|
|
||||||
SELECT
|
|
||||||
'nspacl' as deftype, COALESCE(gt.rolname, 'PUBLIC') AS grantee,
|
|
||||||
g.rolname AS grantor, pg_catalog.array_agg(b.privilege_type) AS privileges,
|
|
||||||
pg_catalog.array_agg(b.is_grantable) AS grantable
|
|
||||||
FROM
|
|
||||||
(SELECT
|
|
||||||
(d).grantee AS grantee, (d).grantor AS grantor,
|
|
||||||
(d).is_grantable AS is_grantable,
|
|
||||||
CASE (d).privilege_type
|
|
||||||
WHEN 'CREATE' THEN 'C'
|
|
||||||
WHEN 'USAGE' THEN 'U'
|
|
||||||
ELSE 'UNKNOWN - ' || (d).privilege_type
|
|
||||||
END AS privilege_type
|
|
||||||
FROM
|
|
||||||
(SELECT pg_catalog.aclexplode(nsp.nspacl) as d
|
|
||||||
FROM pg_catalog.pg_namespace nsp
|
|
||||||
WHERE nsp.oid = {{ scid|qtLiteral }}::OID
|
|
||||||
) a
|
|
||||||
) b
|
|
||||||
LEFT JOIN pg_catalog.pg_roles g ON (b.grantor = g.oid)
|
|
||||||
LEFT JOIN pg_catalog.pg_roles gt ON (b.grantee = gt.oid)
|
|
||||||
GROUP BY g.rolname, gt.rolname
|
|
||||||
ORDER BY grantee;
|
|
@@ -1,17 +0,0 @@
|
|||||||
{% import 'macros/privilege.macros' as PRIVILEGE %}
|
|
||||||
{% if data %}
|
|
||||||
CREATE SCHEMA {{ conn|qtIdent(data.name) }}
|
|
||||||
{% if data.namespaceowner %}
|
|
||||||
AUTHORIZATION {{ conn|qtIdent(data.namespaceowner) }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% if data.description %}
|
|
||||||
COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|
||||||
IS {{ data.description|qtLiteral }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% if data.nspacl %}
|
|
||||||
{% for priv in data.nspacl %}
|
|
||||||
{{ PRIVILEGE.APPLY(conn, 'SCHEMA', priv.grantee, data.name, priv.without_grant, priv.with_grant) }}{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
@@ -1 +0,0 @@
|
|||||||
SELECT nsp.nspname FROM pg_catalog.pg_namespace nsp WHERE nsp.oid = {{ scid|qtLiteral }};
|
|
@@ -1,9 +0,0 @@
|
|||||||
{% import 'catalog/pg/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
nsp.nspname as schema_name,
|
|
||||||
{{ CATALOGS.LIST('nsp') }} AS is_catalog,
|
|
||||||
{{ CATALOGS.DB_SUPPORT('nsp') }} AS db_support
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
WHERE
|
|
||||||
nsp.oid = {{ scid|qtLiteral }}::OID;
|
|
@@ -1,16 +0,0 @@
|
|||||||
{% import 'catalog/pg/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
nsp.oid,
|
|
||||||
{{ CATALOGS.LABELS('nsp', _) }},
|
|
||||||
pg_catalog.has_schema_privilege(nsp.oid, 'CREATE') as can_create,
|
|
||||||
pg_catalog.has_schema_privilege(nsp.oid, 'USAGE') as has_usage
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
WHERE
|
|
||||||
{% if scid %}
|
|
||||||
nsp.oid={{scid}}::oid AND
|
|
||||||
{% endif %}
|
|
||||||
(
|
|
||||||
{{ CATALOGS.LIST('nsp') }}
|
|
||||||
)
|
|
||||||
ORDER BY 2;
|
|
@@ -1,24 +0,0 @@
|
|||||||
{% import 'catalog/pg/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
2 AS nsptyp,
|
|
||||||
nsp.nspname AS name,
|
|
||||||
nsp.oid,
|
|
||||||
pg_catalog.array_to_string(nsp.nspacl::text[], ', ') as acl,
|
|
||||||
r.rolname AS namespaceowner, description,
|
|
||||||
has_schema_privilege(nsp.oid, 'CREATE') AS can_create,
|
|
||||||
(SELECT pg_catalog.array_to_string(defaclacl::text[], ', ') FROM pg_catalog.pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl,
|
|
||||||
(SELECT pg_catalog.array_to_string(defaclacl::text[], ', ') FROM pg_catalog.pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl,
|
|
||||||
(SELECT pg_catalog.array_to_string(defaclacl::text[], ', ') FROM pg_catalog.pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
LEFT OUTER JOIN pg_catalog.pg_description des ON
|
|
||||||
(des.objoid=nsp.oid AND des.classoid='pg_namespace'::regclass)
|
|
||||||
LEFT JOIN pg_catalog.pg_roles r ON (r.oid = nsp.nspowner)
|
|
||||||
WHERE
|
|
||||||
{% if scid %}
|
|
||||||
nsp.oid={{scid}}::oid AND
|
|
||||||
{% endif %}
|
|
||||||
(
|
|
||||||
{{ CATALOGS.LIST('nsp') }}
|
|
||||||
)
|
|
||||||
ORDER BY 1, nspname;
|
|
@@ -1,30 +0,0 @@
|
|||||||
{% import 'macros/security.macros' as SECLABEL %}
|
|
||||||
{% if data %}
|
|
||||||
{# ==== To update catalog comments ==== #}
|
|
||||||
{% if data.description and data.description != o_data.description %}
|
|
||||||
COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
|
||||||
IS {{ data.description|qtLiteral }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{# ==== To update catalog securitylabel ==== #}
|
|
||||||
{# The SQL generated below will change Security Label #}
|
|
||||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
|
||||||
{% set seclabels = data.seclabels %}
|
|
||||||
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
|
|
||||||
{% for r in seclabels.deleted %}
|
|
||||||
{{ SECLABEL.DROP(conn, 'SCHEMA', o_data.name, r.provider) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
|
||||||
{% for r in seclabels.added %}
|
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
|
||||||
{% for r in seclabels.changed %}
|
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
@@ -1,30 +0,0 @@
|
|||||||
{# List of allowed privileges for PostgreSQL 9.2 or later #}
|
|
||||||
{#
|
|
||||||
Format for allowed privileges is:
|
|
||||||
"acl_col": {
|
|
||||||
"type": "name",
|
|
||||||
"acl": [...]
|
|
||||||
}
|
|
||||||
#}
|
|
||||||
{
|
|
||||||
"nspacl": {
|
|
||||||
"type": "DATABASE",
|
|
||||||
"acl": ["c", "C", "T"]
|
|
||||||
},
|
|
||||||
"deftblacl": {
|
|
||||||
"type": "TABLE",
|
|
||||||
"acl": ["r", "a", "w", "d", "D", "x", "t"]
|
|
||||||
},
|
|
||||||
"defseqacl": {
|
|
||||||
"type": "SEQUENCE",
|
|
||||||
"acl": ["U", "r", "w"]
|
|
||||||
},
|
|
||||||
"deffuncacl": {
|
|
||||||
"type": "FUNCTION",
|
|
||||||
"acl": ["X"]
|
|
||||||
},
|
|
||||||
"deftypeacl": {
|
|
||||||
"type": "TYPE",
|
|
||||||
"acl": ["U"]
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,24 +0,0 @@
|
|||||||
{# Fetch privileges for schema #}
|
|
||||||
SELECT
|
|
||||||
'nspacl' as deftype, COALESCE(gt.rolname, 'PUBLIC') AS grantee,
|
|
||||||
g.rolname AS grantor, pg_catalog.array_agg(b.privilege_type) AS privileges,
|
|
||||||
pg_catalog.array_agg(b.is_grantable) AS grantable
|
|
||||||
FROM
|
|
||||||
(SELECT
|
|
||||||
(d).grantee AS grantee, (d).grantor AS grantor,
|
|
||||||
(d).is_grantable AS is_grantable,
|
|
||||||
CASE (d).privilege_type
|
|
||||||
WHEN 'CREATE' THEN 'C'
|
|
||||||
WHEN 'USAGE' THEN 'U'
|
|
||||||
ELSE 'UNKNOWN - ' || (d).privilege_type
|
|
||||||
END AS privilege_type
|
|
||||||
FROM
|
|
||||||
(SELECT pg_catalog.aclexplode(nsp.nspacl) as d
|
|
||||||
FROM pg_catalog.pg_namespace nsp
|
|
||||||
WHERE nsp.oid = {{ scid|qtLiteral }}::OID
|
|
||||||
) a
|
|
||||||
) b
|
|
||||||
LEFT JOIN pg_catalog.pg_roles g ON (b.grantor = g.oid)
|
|
||||||
LEFT JOIN pg_catalog.pg_roles gt ON (b.grantee = gt.oid)
|
|
||||||
GROUP BY g.rolname, gt.rolname
|
|
||||||
ORDER BY grantee;
|
|
@@ -1,17 +0,0 @@
|
|||||||
{% import 'macros/privilege.macros' as PRIVILEGE %}
|
|
||||||
{% if data %}
|
|
||||||
CREATE SCHEMA{% if add_not_exists_clause %} IF NOT EXISTS{% endif %} {{ conn|qtIdent(data.name) }}
|
|
||||||
{% if data.namespaceowner %}
|
|
||||||
AUTHORIZATION {{ conn|qtIdent(data.namespaceowner) }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% if data.description %}
|
|
||||||
COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|
||||||
IS {{ data.description|qtLiteral }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% if data.nspacl %}
|
|
||||||
{% for priv in data.nspacl %}
|
|
||||||
{{ PRIVILEGE.APPLY(conn, 'SCHEMA', priv.grantee, data.name, priv.without_grant, priv.with_grant) }}{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
@@ -1 +0,0 @@
|
|||||||
SELECT nsp.nspname FROM pg_catalog.pg_namespace nsp WHERE nsp.oid = {{ scid|qtLiteral }};
|
|
@@ -1,9 +0,0 @@
|
|||||||
{% import 'catalog/pg/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
nsp.nspname as schema_name,
|
|
||||||
{{ CATALOGS.LIST('nsp') }} AS is_catalog,
|
|
||||||
{{ CATALOGS.DB_SUPPORT('nsp') }} AS db_support
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
WHERE
|
|
||||||
nsp.oid = {{ scid|qtLiteral }}::OID;
|
|
@@ -1,16 +0,0 @@
|
|||||||
{% import 'catalog/pg/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
nsp.oid,
|
|
||||||
{{ CATALOGS.LABELS('nsp', _) }},
|
|
||||||
pg_catalog.has_schema_privilege(nsp.oid, 'CREATE') as can_create,
|
|
||||||
pg_catalog.has_schema_privilege(nsp.oid, 'USAGE') as has_usage
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
WHERE
|
|
||||||
{% if scid %}
|
|
||||||
nsp.oid={{scid}}::oid AND
|
|
||||||
{% endif %}
|
|
||||||
(
|
|
||||||
{{ CATALOGS.LIST('nsp') }}
|
|
||||||
)
|
|
||||||
ORDER BY 2;
|
|
@@ -1,25 +0,0 @@
|
|||||||
{% import 'catalog/pg/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
2 AS nsptyp,
|
|
||||||
nsp.nspname AS name,
|
|
||||||
nsp.oid,
|
|
||||||
pg_catalog.array_to_string(nsp.nspacl::text[], ', ') as acl,
|
|
||||||
r.rolname AS namespaceowner, description,
|
|
||||||
pg_catalog.has_schema_privilege(nsp.oid, 'CREATE') AS can_create,
|
|
||||||
(SELECT pg_catalog.array_to_string(defaclacl::text[], ', ') FROM pg_catalog.pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl,
|
|
||||||
(SELECT pg_catalog.array_to_string(defaclacl::text[], ', ') FROM pg_catalog.pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl,
|
|
||||||
(SELECT pg_catalog.array_to_string(defaclacl::text[], ', ') FROM pg_catalog.pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl,
|
|
||||||
(SELECT pg_catalog.array_to_string(defaclacl::text[], ', ') FROM pg_catalog.pg_default_acl WHERE defaclobjtype = 'T' AND defaclnamespace = nsp.oid) AS typeacl
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
LEFT OUTER JOIN pg_catalog.pg_description des ON
|
|
||||||
(des.objoid=nsp.oid AND des.classoid='pg_namespace'::regclass)
|
|
||||||
LEFT JOIN pg_catalog.pg_roles r ON (r.oid = nsp.nspowner)
|
|
||||||
WHERE
|
|
||||||
{% if scid %}
|
|
||||||
nsp.oid={{scid}}::oid AND
|
|
||||||
{% endif %}
|
|
||||||
(
|
|
||||||
{{ CATALOGS.LIST('nsp') }}
|
|
||||||
)
|
|
||||||
ORDER BY 1, nspname;
|
|
@@ -1,30 +0,0 @@
|
|||||||
{% import 'macros/security.macros' as SECLABEL %}
|
|
||||||
{% if data %}
|
|
||||||
{# ==== To update catalog comments ==== #}
|
|
||||||
{% if data.description and data.description != o_data.description %}
|
|
||||||
COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
|
||||||
IS {{ data.description|qtLiteral }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{# ==== To update catalog securitylabel ==== #}
|
|
||||||
{# The SQL generated below will change Security Label #}
|
|
||||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
|
||||||
{% set seclabels = data.seclabels %}
|
|
||||||
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
|
|
||||||
{% for r in seclabels.deleted %}
|
|
||||||
{{ SECLABEL.DROP(conn, 'SCHEMA', o_data.name, r.provider) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
|
||||||
{% for r in seclabels.added %}
|
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
|
||||||
{% for r in seclabels.changed %}
|
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
@@ -1,26 +0,0 @@
|
|||||||
{# List of allowed privileges for PPAS 9.1 #}
|
|
||||||
{#
|
|
||||||
Format for allowed privileges is:
|
|
||||||
"acl_col": {
|
|
||||||
"type": "name",
|
|
||||||
"acl": [...]
|
|
||||||
}
|
|
||||||
#}
|
|
||||||
{
|
|
||||||
"nspacl": {
|
|
||||||
"type": "DATABASE",
|
|
||||||
"acl": ["c", "C", "T"]
|
|
||||||
},
|
|
||||||
"deftblacl": {
|
|
||||||
"type": "TABLE",
|
|
||||||
"acl": ["r", "a", "w", "d", "D", "x", "t"]
|
|
||||||
},
|
|
||||||
"defseqacl": {
|
|
||||||
"type": "SEQUENCE",
|
|
||||||
"acl": ["U", "r", "w"]
|
|
||||||
},
|
|
||||||
"deffuncacl": {
|
|
||||||
"type": "FUNCTION",
|
|
||||||
"acl": ["X"]
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,24 +0,0 @@
|
|||||||
{# Fetch privileges for schema #}
|
|
||||||
SELECT
|
|
||||||
'nspacl' as deftype, COALESCE(gt.rolname, 'PUBLIC') AS grantee,
|
|
||||||
g.rolname AS grantor, pg_catalog.array_agg(b.privilege_type) AS privileges,
|
|
||||||
pg_catalog.array_agg(b.is_grantable) AS grantable
|
|
||||||
FROM
|
|
||||||
(SELECT
|
|
||||||
(d).grantee AS grantee, (d).grantor AS grantor,
|
|
||||||
(d).is_grantable AS is_grantable,
|
|
||||||
CASE (d).privilege_type
|
|
||||||
WHEN 'CREATE' THEN 'C'
|
|
||||||
WHEN 'USAGE' THEN 'U'
|
|
||||||
ELSE 'UNKNOWN - ' || (d).privilege_type
|
|
||||||
END AS privilege_type
|
|
||||||
FROM
|
|
||||||
(SELECT pg_catalog.aclexplode(nsp.nspacl) as d
|
|
||||||
FROM pg_catalog.pg_namespace nsp
|
|
||||||
WHERE nsp.oid = {{ scid|qtLiteral }}::OID
|
|
||||||
) a
|
|
||||||
) b
|
|
||||||
LEFT JOIN pg_catalog.pg_roles g ON (b.grantor = g.oid)
|
|
||||||
LEFT JOIN pg_catalog.pg_roles gt ON (b.grantee = gt.oid)
|
|
||||||
GROUP BY g.rolname, gt.rolname
|
|
||||||
ORDER BY grantee;
|
|
@@ -1,17 +0,0 @@
|
|||||||
{% import 'macros/privilege.macros' as PRIVILEGE %}
|
|
||||||
{% if data %}
|
|
||||||
CREATE SCHEMA {{ conn|qtIdent(data.name) }}
|
|
||||||
{% if data.namespaceowner %}
|
|
||||||
AUTHORIZATION {{ conn|qtIdent(data.namespaceowner) }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% if data.description %}
|
|
||||||
COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|
||||||
IS {{ data.description|qtLiteral }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% if data.nspacl %}
|
|
||||||
{% for priv in data.nspacl %}
|
|
||||||
{{ PRIVILEGE.APPLY(conn, 'SCHEMA', priv.grantee, data.name, priv.without_grant, priv.with_grant) }}{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
@@ -1 +0,0 @@
|
|||||||
SELECT nsp.nspname FROM pg_catalog.pg_namespace nsp WHERE nsp.oid = {{ scid|qtLiteral }};
|
|
@@ -1,9 +0,0 @@
|
|||||||
{% import 'catalog/ppas/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
nsp.nspname as schema_name,
|
|
||||||
{{ CATALOGS.LIST('nsp') }} AS is_catalog,
|
|
||||||
{{ CATALOGS.DB_SUPPORT('nsp') }} AS db_support
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
WHERE
|
|
||||||
nsp.oid = {{ scid|qtLiteral }}::OID;
|
|
@@ -1,17 +0,0 @@
|
|||||||
{% import 'catalog/ppas/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
nsp.oid,
|
|
||||||
{{ CATALOGS.LABELS('nsp', _) }},
|
|
||||||
pg_catalog.has_schema_privilege(nsp.oid, 'CREATE') as can_create,
|
|
||||||
pg_catalog.has_schema_privilege(nsp.oid, 'USAGE') as has_usage
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
WHERE
|
|
||||||
{% if scid %}
|
|
||||||
nsp.oid={{scid}}::oid AND
|
|
||||||
{% endif %}
|
|
||||||
nsp.nspparent = 0 AND
|
|
||||||
(
|
|
||||||
{{ CATALOGS.LIST('nsp') }}
|
|
||||||
)
|
|
||||||
ORDER BY 2;
|
|
@@ -1,26 +0,0 @@
|
|||||||
{% import 'catalog/ppas/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
2 AS nsptyp,
|
|
||||||
nsp.nspname AS name,
|
|
||||||
nsp.oid,
|
|
||||||
pg_catalog.array_to_string(nsp.nspacl::text[], ', ') as acl,
|
|
||||||
r.rolname AS namespaceowner, description,
|
|
||||||
pg_catalog.has_schema_privilege(nsp.oid, 'CREATE') AS can_create,
|
|
||||||
(SELECT pg_catalog.array_to_string(defaclacl::text[], ', ') FROM pg_catalog.pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = nsp.oid) AS tblacl,
|
|
||||||
(SELECT pg_catalog.array_to_string(defaclacl::text[], ', ') FROM pg_catalog.pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = nsp.oid) AS seqacl,
|
|
||||||
(SELECT pg_catalog.array_to_string(defaclacl::text[], ', ') FROM pg_catalog.pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = nsp.oid) AS funcacl,
|
|
||||||
(SELECT pg_catalog.array_agg(provider || '=' || label) FROM pg_catalog.pg_seclabels sl1 WHERE sl1.objoid=nsp.oid) AS seclabels
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
LEFT OUTER JOIN pg_catalog.pg_description des ON
|
|
||||||
(des.objoid=nsp.oid AND des.classoid='pg_namespace'::regclass)
|
|
||||||
LEFT JOIN pg_catalog.pg_roles r ON (r.oid = nsp.nspowner)
|
|
||||||
WHERE
|
|
||||||
{% if scid %}
|
|
||||||
nsp.oid={{scid}}::oid AND
|
|
||||||
{% endif %}
|
|
||||||
nsp.nspparent = 0 AND
|
|
||||||
(
|
|
||||||
{{ CATALOGS.LIST('nsp') }}
|
|
||||||
)
|
|
||||||
ORDER BY 1, nspname;
|
|
@@ -1,30 +0,0 @@
|
|||||||
{% import 'macros/security.macros' as SECLABEL %}
|
|
||||||
{% if data %}
|
|
||||||
{# ==== To update catalog comments ==== #}
|
|
||||||
{% if data.description and data.description != o_data.description %}
|
|
||||||
COMMENT ON SCHEMA {{ conn|qtIdent(o_data.name) }}
|
|
||||||
IS {{ data.description|qtLiteral }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{# ==== To update catalog securitylabel ==== #}
|
|
||||||
{# The SQL generated below will change Security Label #}
|
|
||||||
{% if data.seclabels and data.seclabels|length > 0 %}
|
|
||||||
{% set seclabels = data.seclabels %}
|
|
||||||
{% if 'deleted' in seclabels and seclabels.deleted|length > 0 %}
|
|
||||||
{% for r in seclabels.deleted %}
|
|
||||||
{{ SECLABEL.DROP(conn, 'SCHEMA', o_data.name, r.provider) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if 'added' in seclabels and seclabels.added|length > 0 %}
|
|
||||||
{% for r in seclabels.added %}
|
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if 'changed' in seclabels and seclabels.changed|length > 0 %}
|
|
||||||
{% for r in seclabels.changed %}
|
|
||||||
{{ SECLABEL.APPLY(conn, 'SCHEMA', o_data.name, r.provider, r.label) }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
@@ -1,30 +0,0 @@
|
|||||||
{# List of allowed privileges for PPAS 9.2 or later #}
|
|
||||||
{#
|
|
||||||
Format for allowed privileges is:
|
|
||||||
"acl_col": {
|
|
||||||
"type": "name",
|
|
||||||
"acl": [...]
|
|
||||||
}
|
|
||||||
#}
|
|
||||||
{
|
|
||||||
"nspacl": {
|
|
||||||
"type": "DATABASE",
|
|
||||||
"acl": ["c", "C", "T"]
|
|
||||||
},
|
|
||||||
"deftblacl": {
|
|
||||||
"type": "TABLE",
|
|
||||||
"acl": ["r", "a", "w", "d", "D", "x", "t"]
|
|
||||||
},
|
|
||||||
"defseqacl": {
|
|
||||||
"type": "SEQUENCE",
|
|
||||||
"acl": ["U", "r", "w"]
|
|
||||||
},
|
|
||||||
"deffuncacl": {
|
|
||||||
"type": "FUNCTION",
|
|
||||||
"acl": ["X"]
|
|
||||||
},
|
|
||||||
"deftypeacl": {
|
|
||||||
"type": "TYPE",
|
|
||||||
"acl": ["U"]
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,24 +0,0 @@
|
|||||||
{# Fetch privileges for schema #}
|
|
||||||
SELECT
|
|
||||||
'nspacl' as deftype, COALESCE(gt.rolname, 'PUBLIC') AS grantee,
|
|
||||||
g.rolname AS grantor, pg_catalog.array_agg(b.privilege_type) AS privileges,
|
|
||||||
pg_catalog.array_agg(b.is_grantable) AS grantable
|
|
||||||
FROM
|
|
||||||
(SELECT
|
|
||||||
(d).grantee AS grantee, (d).grantor AS grantor,
|
|
||||||
(d).is_grantable AS is_grantable,
|
|
||||||
CASE (d).privilege_type
|
|
||||||
WHEN 'CREATE' THEN 'C'
|
|
||||||
WHEN 'USAGE' THEN 'U'
|
|
||||||
ELSE 'UNKNOWN - ' || (d).privilege_type
|
|
||||||
END AS privilege_type
|
|
||||||
FROM
|
|
||||||
(SELECT pg_catalog.aclexplode(nsp.nspacl) as d
|
|
||||||
FROM pg_catalog.pg_namespace nsp
|
|
||||||
WHERE nsp.oid = {{ scid|qtLiteral }}::OID
|
|
||||||
) a
|
|
||||||
) b
|
|
||||||
LEFT JOIN pg_catalog.pg_roles g ON (b.grantor = g.oid)
|
|
||||||
LEFT JOIN pg_catalog.pg_roles gt ON (b.grantee = gt.oid)
|
|
||||||
GROUP BY g.rolname, gt.rolname
|
|
||||||
ORDER BY grantee;
|
|
@@ -1,17 +0,0 @@
|
|||||||
{% import 'macros/privilege.macros' as PRIVILEGE %}
|
|
||||||
{% if data %}
|
|
||||||
CREATE SCHEMA {{ conn|qtIdent(data.name) }}
|
|
||||||
{% if data.namespaceowner %}
|
|
||||||
AUTHORIZATION {{ conn|qtIdent(data.namespaceowner) }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% if data.description %}
|
|
||||||
COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
|
|
||||||
IS {{ data.description|qtLiteral }};
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% if data.nspacl %}
|
|
||||||
{% for priv in data.nspacl %}
|
|
||||||
{{ PRIVILEGE.APPLY(conn, 'SCHEMA', priv.grantee, data.name, priv.without_grant, priv.with_grant) }}{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
@@ -1 +0,0 @@
|
|||||||
SELECT nsp.nspname FROM pg_catalog.pg_namespace nsp WHERE nsp.oid = {{ scid|qtLiteral }};
|
|
@@ -1,9 +0,0 @@
|
|||||||
{% import 'catalog/ppas/macros/catalogs.sql' as CATALOGS %}
|
|
||||||
SELECT
|
|
||||||
nsp.nspname as schema_name,
|
|
||||||
{{ CATALOGS.LIST('nsp') }} AS is_catalog,
|
|
||||||
{{ CATALOGS.DB_SUPPORT('nsp') }} AS db_support
|
|
||||||
FROM
|
|
||||||
pg_catalog.pg_namespace nsp
|
|
||||||
WHERE
|
|
||||||
nsp.oid = {{ scid|qtLiteral }}::OID;
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user