Skip to content

Commit 3213664

Browse files
Fixed an issue where query tool should show results and messages only from the last executed query. #8010
Fixed an issue where query tool should not prompt for unsaved changes when there are no changes. #8127
1 parent 6d5b167 commit 3213664

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import React, {useContext, useCallback, useEffect, useMemo } from 'react';
1010
import { format } from 'sql-formatter';
1111
import { QueryToolContext, QueryToolEventsContext } from '../QueryToolComponent';
1212
import CodeMirror from '../../../../../../static/js/components/ReactCodeMirror';
13-
import {PANELS, QUERY_TOOL_EVENTS} from '../QueryToolConstants';
13+
import {OS_EOL, PANELS, QUERY_TOOL_EVENTS} from '../QueryToolConstants';
1414
import url_for from 'sources/url_for';
1515
import { LayoutDockerContext, LAYOUT_EVENTS } from '../../../../../../static/js/helpers/Layout';
1616
import ConfirmSaveContent from '../../../../../../static/js/Dialogs/ConfirmSaveContent';
@@ -190,7 +190,9 @@ export default function Query({onTextSelect, handleEndOfLineChange}) {
190190
editor.current.markClean();
191191
eventBus.fireEvent(QUERY_TOOL_EVENTS.LOAD_FILE_DONE, fileName, true);
192192
const lineSep = res.data.includes('\r\n') ? 'crlf' : 'lf';
193-
handleEndOfLineChange(lineSep);
193+
if (lineSep !== OS_EOL){
194+
handleEndOfLineChange(lineSep);
195+
}
194196
}).catch((err)=>{
195197
eventBus.fireEvent(QUERY_TOOL_EVENTS.LOAD_FILE_DONE, null, false);
196198
pgAdmin.Browser.notifier.error(parseApiError(err));

web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,8 @@ export class ResultSetUtils {
753753
}
754754
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, tabMsg, true);
755755
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.FOCUS_PANEL, PANELS.MESSAGES);
756+
/* Clear the query data if the query has no result to display.*/
757+
onResultsAvailable(null, [], []);
756758
}
757759
return retMsg;
758760
}

web/pgadmin/utils/driver/psycopg3/connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,8 @@ def poll(self, formatted_exception_msg=False, no_result=False):
15101510
for col in self.column_info:
15111511
col['pos'] = pos
15121512
pos += 1
1513-
1513+
else:
1514+
self.column_info = None
15141515
self.row_count = cur.get_rowcount()
15151516
if not no_result and cur.get_rowcount() > 0:
15161517
result = []

0 commit comments

Comments
 (0)