diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx index 31125316e..c8f650c52 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx @@ -10,7 +10,7 @@ import React, {useContext, useCallback, useEffect, useMemo } from 'react'; import { format } from 'sql-formatter'; import { QueryToolContext, QueryToolEventsContext } from '../QueryToolComponent'; import CodeMirror from '../../../../../../static/js/components/ReactCodeMirror'; -import {PANELS, QUERY_TOOL_EVENTS} from '../QueryToolConstants'; +import {OS_EOL, PANELS, QUERY_TOOL_EVENTS} from '../QueryToolConstants'; import url_for from 'sources/url_for'; import { LayoutDockerContext, LAYOUT_EVENTS } from '../../../../../../static/js/helpers/Layout'; import ConfirmSaveContent from '../../../../../../static/js/Dialogs/ConfirmSaveContent'; @@ -190,7 +190,9 @@ export default function Query({onTextSelect, handleEndOfLineChange}) { editor.current.markClean(); eventBus.fireEvent(QUERY_TOOL_EVENTS.LOAD_FILE_DONE, fileName, true); const lineSep = res.data.includes('\r\n') ? 'crlf' : 'lf'; - handleEndOfLineChange(lineSep); + if (lineSep !== OS_EOL){ + handleEndOfLineChange(lineSep); + } }).catch((err)=>{ eventBus.fireEvent(QUERY_TOOL_EVENTS.LOAD_FILE_DONE, null, false); pgAdmin.Browser.notifier.error(parseApiError(err)); diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx index aab595514..d46ccf480 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx @@ -753,6 +753,8 @@ export class ResultSetUtils { } this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, tabMsg, true); this.eventBus.fireEvent(QUERY_TOOL_EVENTS.FOCUS_PANEL, PANELS.MESSAGES); + /* Clear the query data if the query has no result to display.*/ + onResultsAvailable(null, [], []); } return retMsg; } diff --git a/web/pgadmin/utils/driver/psycopg3/connection.py b/web/pgadmin/utils/driver/psycopg3/connection.py index df1166392..1e9aeae02 100644 --- a/web/pgadmin/utils/driver/psycopg3/connection.py +++ b/web/pgadmin/utils/driver/psycopg3/connection.py @@ -1510,7 +1510,8 @@ Failed to reset the connection to the server due to following error: for col in self.column_info: col['pos'] = pos pos += 1 - + else: + self.column_info = None self.row_count = cur.get_rowcount() if not no_result and cur.get_rowcount() > 0: result = []