mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-09 06:55:54 -06:00
Fix handling of CREATE TABLE OF <type>. Fixes #2534
This commit is contained in:
parent
815c4b4c45
commit
d151bdb4cd
@ -725,19 +725,33 @@ define('pgadmin.node.table', [
|
|||||||
arg = undefined,
|
arg = undefined,
|
||||||
column_collection = self.model.get('columns');
|
column_collection = self.model.get('columns');
|
||||||
|
|
||||||
if (!_.isUndefined(tbl_name) &&
|
if (!_.isUndefined(tbl_name) && !_.isNull(tbl_name) &&
|
||||||
tbl_name !== '' && column_collection.length !== 0) {
|
tbl_name !== '' && column_collection.length !== 0) {
|
||||||
var msg = gettext('Changing of type table will clear columns collection');
|
var title = gettext('Remove column definitions?'),
|
||||||
alertify.confirm(msg, function (e) {
|
msg = gettext('Changing \'Of type\' will remove column definitions.');
|
||||||
if (e) {
|
|
||||||
|
alertify.confirm(title, msg, function (e) {
|
||||||
// User clicks Ok, lets clear columns collection
|
// User clicks Ok, lets clear columns collection
|
||||||
column_collection.reset();
|
column_collection.remove(
|
||||||
} else {
|
column_collection.filter(function(model) {
|
||||||
return this;
|
return true;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
setTimeout(function() {
|
||||||
|
self.model.set('typname', null);
|
||||||
|
}, 10)
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
} else if (!_.isUndefined(tbl_name) && tbl_name === '') {
|
} else if (!_.isUndefined(tbl_name) && tbl_name === '') {
|
||||||
column_collection.reset();
|
column_collection.remove(
|
||||||
|
column_collection.filter(function(model) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run Ajax now to fetch columns
|
// Run Ajax now to fetch columns
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}}
|
CREATE {% if data.relpersistence %}UNLOGGED {% endif %}TABLE {{conn|qtIdent(data.schema, data.name)}}{{empty_bracket}}
|
||||||
{% if data.typname %}
|
{% if data.typname %}
|
||||||
OF {{ conn|qtTypeIdent(data.typname) }}
|
OF {{ data.typname }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if data.like_relation or data.coll_inherits or data.columns|length > 0 or data.primary_key|length > 0 or data.unique_constraint|length > 0 or data.foreign_key|length > 0 or data.check_constraint|length > 0 or data.exclude_constraint|length > 0 %}
|
{% if data.like_relation or data.coll_inherits or data.columns|length > 0 or data.primary_key|length > 0 or data.unique_constraint|length > 0 or data.foreign_key|length > 0 or data.check_constraint|length > 0 or data.exclude_constraint|length > 0 %}
|
||||||
(
|
(
|
||||||
|
Loading…
Reference in New Issue
Block a user