Fix an issue where sequence owner is remove on sequence edit. #5810

This commit is contained in:
Aditya Toshniwal 2023-02-22 14:06:44 +05:30 committed by GitHub
parent cf28d7df32
commit 9abbd30790
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 6 deletions

View File

@ -51,6 +51,13 @@ export class OwnedBySchema extends BaseUISchema {
optionsReloadBasis: state.owned_table,
};
},
depChange: (state)=>{
if(!state.owned_table) {
return {
owned_column: null,
};
}
}
}
];
}

View File

@ -11,7 +11,7 @@ ALTER SEQUENCE IF EXISTS {{ conn|qtIdent(o_data.schema, data.name) }}
OWNER TO {{ conn|qtIdent(data.seqowner) }};
{% endif %}
{% if (data.owned_table == None or data.owned_table is not defined) and (o_data.owned_table is defined and o_data.owned_table != None) and (data.owned_column == None or data.owned_column is not defined) %}
{% if (data.owned_table == None) and (data.owned_column == None) %}
ALTER SEQUENCE IF EXISTS {{ conn|qtIdent(o_data.schema, data.name) }}
OWNED BY NONE;
{% elif (data.owned_table is defined or data.owned_column is defined) and (data.owned_table != o_data.owned_table or data.owned_column != o_data.owned_column) %}

View File

@ -711,12 +711,12 @@ define('pgadmin.browser.node', [
pgBrowser.removeTreeNode(i, selectNextNode);
}
return true;
}).catch(function(xhr) {
let errmsg = xhr.responseText;
}).catch(function(error) {
let errmsg = error.request?.responseText;
/* Error from the server */
if (xhr.status == 417 || xhr.status == 410 || xhr.status == 500) {
if (error.request?.status == 417 || error.request?.status == 410 || error.request?.status == 500) {
try {
let data = JSON.parse(xhr.responseText);
let data = error.response.data;
errmsg = data.info || data.errormsg;
} catch (e) {
console.warn(e.stack || e);

View File

@ -77,7 +77,7 @@ function getForQueryParams(data) {
let retData = {...data};
Object.keys(retData).forEach((key)=>{
let value = retData[key];
if(_.isObject(value)) {
if(_.isObject(value) || _.isNull(value)) {
retData[key] = JSON.stringify(value);
}
});