mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Use the right SQL commands for killing a process on PostgreSQL. See http://www.heidisql.com/forum.php?t=21760
This commit is contained in:
@ -4748,8 +4748,8 @@ msgid "Displaying objects from \"%s\" ..."
|
||||
msgstr "Displaying objects from \"%s\" ..."
|
||||
|
||||
#: main.pas:4784
|
||||
msgid "Ignoring own process id #%s when trying to kill it."
|
||||
msgstr "Ignoring own process id #%s when trying to kill it."
|
||||
msgid "Ignoring own process id #%d when trying to kill it."
|
||||
msgstr "Ignoring own process id #%d when trying to kill it."
|
||||
|
||||
#: main.pas:5158
|
||||
msgid "Uptime"
|
||||
|
@ -284,7 +284,7 @@ type
|
||||
spAddColumn, spChangeColumn,
|
||||
spSessionVariables, spGlobalVariables,
|
||||
spISTableSchemaCol,
|
||||
spUSEQuery, spKillQuery,
|
||||
spUSEQuery, spKillQuery, spKillProcess,
|
||||
spFuncLength, spFuncCeil);
|
||||
|
||||
TDBConnection = class(TComponent)
|
||||
@ -2029,6 +2029,7 @@ begin
|
||||
FSQLSpecifities[spISTableSchemaCol] := 'TABLE_SCHEMA';
|
||||
FSQLSpecifities[spUSEQuery] := 'USE %s';
|
||||
FSQLSpecifities[spKillQuery] := 'KILL %d';
|
||||
FSQLSpecifities[spKillProcess] := 'KILL %d';
|
||||
FSQLSpecifities[spFuncLength] := 'LENGTH';
|
||||
FSQLSpecifities[spFuncCeil] := 'CEIL';
|
||||
end;
|
||||
@ -2044,6 +2045,7 @@ begin
|
||||
FSQLSpecifities[spISTableSchemaCol] := 'TABLE_CATALOG';
|
||||
FSQLSpecifities[spUSEQuery] := 'USE %s';
|
||||
FSQLSpecifities[spKillQuery] := 'KILL %d';
|
||||
FSQLSpecifities[spKillProcess] := 'KILL %d';
|
||||
FSQLSpecifities[spFuncLength] := 'LEN';
|
||||
FSQLSpecifities[spFuncCeil] := 'CEILING';
|
||||
end;
|
||||
@ -2059,6 +2061,7 @@ begin
|
||||
FSQLSpecifities[spISTableSchemaCol] := 'table_schema';
|
||||
FSQLSpecifities[spUSEQuery] := 'SET search_path TO %s';
|
||||
FSQLSpecifities[spKillQuery] := 'SELECT pg_cancel_backend(%d)';
|
||||
FSQLSpecifities[spKillProcess] := 'SELECT pg_cancel_backend(%d)';
|
||||
FSQLSpecifities[spFuncLength] := 'LENGTH';
|
||||
FSQLSpecifities[spFuncCeil] := 'CEIL';
|
||||
end;
|
||||
|
@ -5441,7 +5441,7 @@ end;
|
||||
procedure TMainForm.KillProcess(Sender: TObject);
|
||||
var
|
||||
t: Boolean;
|
||||
pid: String;
|
||||
pid: Int64;
|
||||
Node: PVirtualNode;
|
||||
Conn: TDBConnection;
|
||||
begin
|
||||
@ -5452,12 +5452,12 @@ begin
|
||||
begin
|
||||
Node := GetNextNode(ListProcesses, nil, True);
|
||||
while Assigned(Node) do begin
|
||||
pid := ListProcesses.Text[Node, ListProcesses.Header.MainColumn];
|
||||
pid := StrToInt64Def(ListProcesses.Text[Node, ListProcesses.Header.MainColumn], 0);
|
||||
// Don't kill own process
|
||||
if pid = IntToStr(Conn.ThreadId) then
|
||||
LogSQL(f_('Ignoring own process id #%s when trying to kill it.', [pid]))
|
||||
if pid = Conn.ThreadId then
|
||||
LogSQL(f_('Ignoring own process id #%d when trying to kill it.', [pid]))
|
||||
else try
|
||||
Conn.Query('KILL '+pid);
|
||||
Conn.Query(Format(Conn.GetSQLSpecifity(spKillProcess), [pid]));
|
||||
except
|
||||
on E:EDatabaseError do begin
|
||||
if Conn.LastErrorCode <> 1094 then
|
||||
|
Reference in New Issue
Block a user