Fix comment removal for various nodes. Fixes #1331

This commit is contained in:
Murtuza Zabuawala 2016-06-13 16:22:50 +01:00 committed by Dave Page
parent 970d3aafbf
commit 1f9d0ffc54
16 changed files with 22 additions and 20 deletions

View File

@ -18,7 +18,7 @@ ALTER EVENT TRIGGER {{ conn|qtIdent(o_data.name) }}
{% endif %}
{% endif %}
{% if data.comment and data.comment != o_data.comment %}
{% if data.comment is defined and data.comment != o_data.comment %}
COMMENT ON EVENT TRIGGER {{ conn|qtIdent(data.name) }}
IS '{{ data.comment }}';
{% endif %}
@ -63,4 +63,4 @@ ALTER EVENT TRIGGER {{ conn|qtIdent(data.name) }}
{% if data.eventowner and data.eventowner != o_data.eventowner %}
ALTER EVENT TRIGGER {{ conn|qtIdent(data.name) }}
OWNER TO {{data.eventowner}};
{% endif %}
{% endif %}

View File

@ -6,7 +6,7 @@ ALTER COLLATION {{ conn|qtIdent(o_data.schema, o_data.name) }}
{% endif %}
{# Change object's comment #}
{% if data.description and data.description != o_data.description %}
{% if data.description is defined and data.description != o_data.description %}
COMMENT ON COLLATION {{ conn|qtIdent(o_data.schema, o_data.name) }}
IS {{ data.description|qtLiteral }};

View File

@ -6,8 +6,8 @@ ALTER DOMAIN {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
ALTER DOMAIN {{ conn|qtIdent(o_data.nspname, o_data.relname) }}
VALIDATE CONSTRAINT {{ conn|qtIdent(name) }};{% endif -%}{% if data.description %}
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 }}';{% endif %}
IS {{ data.description|qtLiteral }};{% endif %}

View File

@ -58,7 +58,7 @@ ALTER DOMAIN {{ conn|qtIdent(o_data.basensp, name) }}
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
{% endfor -%}
{% endif -%}{% if data.description %}
{% endif -%}{% if data.description is defined and data.description != o_data.description %}
COMMENT ON DOMAIN {{ conn|qtIdent(o_data.basensp, name) }}
IS {{ data.description|qtLiteral }};

View File

@ -69,7 +69,7 @@ ALTER DOMAIN {{ conn|qtIdent(o_data.basensp, name) }}
{{ SECLABLE.SET(conn, 'DOMAIN', name, r.provider, r.label, o_data.basensp) }}
{% endfor %}
{% endif -%}{% if data.description %}
{% endif -%}{% if data.description is defined and data.description != o_data.description %}
COMMENT ON DOMAIN {{ conn|qtIdent(o_data.basensp, name) }}
IS {{ data.description|qtLiteral }};

View File

@ -14,7 +14,7 @@ ALTER SCHEMA {{ conn|qtIdent(data.name) }}
{% endif %}
{# Update the comments/description #}
{% if data.description and data.description != o_data.description %}
{% if data.description is defined and data.description != o_data.description %}
COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
IS {{ data.description|qtLiteral }};

View File

@ -14,7 +14,7 @@ ALTER SCHEMA {{ conn|qtIdent(data.name) }}
{% endif %}
{# Update the comments/description #}
{% if data.description and data.description != o_data.description %}
{% if data.description is defined and data.description != o_data.description %}
COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
IS {{ data.description|qtLiteral }};

View File

@ -15,7 +15,7 @@ ALTER SCHEMA {{ conn|qtIdent(data.name) }}
{% endif %}
{### To update SCHEMA comments ###}
{% if data.description and data.description != o_data.description %}
{% if data.description is defined and data.description != o_data.description %}
COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
IS {{ data.description|qtLiteral }};

View File

@ -15,7 +15,7 @@ ALTER SCHEMA {{ conn|qtIdent(data.name) }}
{% endif %}
{### To update SCHEMA comments ###}
{% if data.description and data.description != o_data.description %}
{% if data.description is defined and data.description != o_data.description %}
COMMENT ON SCHEMA {{ conn|qtIdent(data.name) }}
IS {{ data.description|qtLiteral }};

View File

@ -10,7 +10,7 @@ ALTER TYPE {{ conn|qtIdent(o_data.schema, o_data.name) }}
{% endif %}
{#======================================#}
{# Below will change objects comment #}
{% if data.description and data.description != o_data.description %}
{% if data.description is defined and data.description != o_data.description %}
COMMENT ON TYPE {{ conn|qtIdent(o_data.schema, o_data.name) }}
IS {{ data.description|qtLiteral }};

View File

@ -224,7 +224,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
},{
id: 'datowner', label:'{{ _('Owner') }}',
editable: false, type: 'text', node: 'role',
control: Backform.NodeListByNameControl
control: Backform.NodeListByNameControl, select2: { allowClear: false }
},{
id: 'acl', label: '{{ _('Privileges') }}', type: 'text',
group: '{{ _('Security') }}', mode: ['properties'], disabled: true
@ -240,11 +240,13 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
id: 'template', label: '{{ _('Template') }}',
editable: false, type: 'text', group: 'Definition',
disabled: function(m) { return !m.isNew(); },
control: 'node-list-by-name', node: 'database', cache_level: 'server'
control: 'node-list-by-name', node: 'database', cache_level: 'server',
select2: { allowClear: false }
},{
id: 'spcname', label: '{{ _('Tablespace') }}',
editable: false, type: 'text', group: 'Definition',
control: 'node-list-by-name', node: 'tablespace',
select2: { allowClear: false },
filter: function(m) {
if (m.label == "pg_global") return false;
else return true;

View File

@ -7,7 +7,7 @@
ALTER DATABASE {{ conn|qtIdent(data.name) }} OWNER TO {{ conn|qtIdent(data.datowner) }};
{% endif %}
{# Change the comments/description #}
{% if data.comments %}
{% if data.comments is defined %}
COMMENT ON DATABASE {{ conn|qtIdent(data.name) }}
IS {{ data.comments|qtLiteral }};
{% endif %}

View File

@ -8,7 +8,7 @@
ALTER DATABASE {{ conn|qtIdent(data.name) }} OWNER TO {{ conn|qtIdent(data.datowner) }};
{% endif %}
{# Change the comments/description #}
{% if data.comments %}
{% if data.comments is defined %}
COMMENT ON DATABASE {{ conn|qtIdent(data.name) }}
IS {{ data.comments|qtLiteral }};
{% endif %}

View File

@ -8,7 +8,7 @@
ALTER DATABASE {{ conn|qtIdent(data.name) }} OWNER TO {{ conn|qtIdent(data.datowner) }};
{% endif %}
{# Change the comments/description #}
{% if data.comments %}
{% if data.comments is defined %}
COMMENT ON DATABASE {{ conn|qtIdent(data.name) }}
IS {{ data.comments|qtLiteral }};
{% endif %}

View File

@ -3,7 +3,7 @@
{% import 'macros/privilege.macros' as PRIVILEGE %}
{% if data %}
{# ==== To update tablespace name ==== #}
{% if data.name != o_data.name %}
{% if data.name and data.name != o_data.name %}
ALTER TABLESPACE {{ conn|qtIdent(o_data.name) }}
RENAME TO {{ conn|qtIdent(data.name) }};
@ -55,4 +55,4 @@ COMMENT ON TABLESPACE {{ conn|qtIdent(data.name) }}
{% endif %}
{% endif %}
{% endif %}
{% endif %}

View File

@ -4,7 +4,7 @@
{% import 'macros/privilege.macros' as PRIVILEGE %}
{% if data %}
{# ==== To update tablespace name ==== #}
{% if data.name != o_data.name %}
{% if data.name and data.name != o_data.name %}
ALTER TABLESPACE {{ conn|qtIdent(o_data.name) }}
RENAME TO {{ conn|qtIdent(data.name) }};