Fix a SQL error occurring on roles dependents SQL. #6128

This commit is contained in:
Aditya Toshniwal
2023-04-20 10:18:00 +05:30
committed by GitHub
parent 41e4f3eed9
commit ed941b5b95
4 changed files with 7 additions and 5 deletions

View File

@@ -1130,7 +1130,7 @@ rolmembership:{
status, result = temp_conn.execute_dict(query)
if not status:
current_app.logger.error(result)
raise ExecuteError(result)
RoleView._handle_dependents_data(result, types, dependents, db_row)

View File

@@ -21,13 +21,13 @@ WHERE cl.oid IN (SELECT objid FROM pg_catalog.pg_shdepend WHERE refobjid={{rid}}
UNION ALL SELECT 'n', null, nspname, null
FROM pg_catalog.pg_namespace nsp
WHERE nsp.oid IN (SELECT objid FROM pg_catalog.pg_shdepend WHERE refobjid={{rid}}::oid) AND nsp.oid > {{lastsysoid}}::oid
UNION ALL SELECT CASE WHEN typtype='d' THEN 'd'::"char" ELSE 'y'::"char" END, null, typname, null
UNION ALL SELECT CASE WHEN typtype='d' THEN 'd' ELSE 'y' END, null, typname, null
FROM pg_catalog.pg_type ty
WHERE ty.oid IN (SELECT objid FROM pg_catalog.pg_shdepend WHERE refobjid={{rid}}::oid) AND ty.oid > {{lastsysoid}}::oid
UNION ALL SELECT 'C', null, conname, null
FROM pg_catalog.pg_conversion co
WHERE co.oid IN (SELECT objid FROM pg_catalog.pg_shdepend WHERE refobjid={{rid}}::oid) AND co.oid > {{lastsysoid}}::oid
UNION ALL SELECT CASE WHEN prorettype=2279 THEN 'T'::"char" ELSE 'p'::"char" END, null, proname, null
UNION ALL SELECT CASE WHEN prorettype=2279 THEN 'T' ELSE 'p' END, null, proname, null
FROM pg_catalog.pg_proc pr
WHERE pr.oid IN (SELECT objid FROM pg_catalog.pg_shdepend WHERE refobjid={{rid}}::oid) AND pr.oid > {{lastsysoid}}::oid
UNION ALL SELECT 'o', null, oprname || '('::text || COALESCE(tl.typname, ''::text) || CASE WHEN tl.oid IS NOT NULL

View File

@@ -18,6 +18,7 @@ import { makeStyles } from '@material-ui/core/styles';
import { getURL } from '../../../static/utils/utils';
import Loader from 'sources/components/Loader';
import EmptyPanelMessage from '../../../../static/js/components/EmptyPanelMessage';
import { parseApiError } from '../../../../static/js/api_instance';
const useStyles = makeStyles((theme) => ({
emptyPanel: {
@@ -135,7 +136,7 @@ export default function Dependencies({ nodeData, item, node, ...props }) {
.catch((e) => {
Notify.alert(
gettext('Failed to retrieve data from the server.'),
gettext(e.message)
parseApiError(e)
);
// show failed message.
setMsg(gettext('Failed to retrieve data from the server.'));

View File

@@ -18,6 +18,7 @@ import { makeStyles } from '@material-ui/core/styles';
import { getURL } from '../../../static/utils/utils';
import Loader from 'sources/components/Loader';
import EmptyPanelMessage from '../../../../static/js/components/EmptyPanelMessage';
import { parseApiError } from '../../../../static/js/api_instance';
const useStyles = makeStyles((theme) => ({
emptyPanel: {
@@ -135,7 +136,7 @@ export default function Dependents({ nodeData, item, node, ...props }) {
.catch((e) => {
Notify.alert(
gettext('Failed to retrieve data from the server.'),
gettext(e.message)
parseApiError(e)
);
// show failed message.
setMsg(gettext('Failed to retrieve data from the server.'));