Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
207f6ed3
Commit
207f6ed3
authored
Dec 15, 2000
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print the error message before attempting to reset the connection after a
backend crash.
parent
352cd1f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
27 deletions
+26
-27
src/bin/psql/common.c
src/bin/psql/common.c
+26
-27
No files found.
src/bin/psql/common.c
View file @
207f6ed3
...
...
@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.2
7 2000/11/27 02:20:36 tgl
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.2
8 2000/12/15 17:54:43 petere
Exp $
*/
#include "postgres.h"
#include "common.h"
...
...
@@ -315,32 +315,6 @@ PSQLexec(const char *query)
if
(
PQresultStatus
(
res
)
!=
PGRES_COPY_OUT
)
cancelConn
=
NULL
;
if
(
PQstatus
(
pset
.
db
)
==
CONNECTION_BAD
)
{
if
(
!
pset
.
cur_cmd_interactive
)
{
psql_error
(
"connection to server was lost
\n
"
);
exit
(
EXIT_BADCONN
);
}
fputs
(
"The connection to the server was lost. Attempting reset: "
,
stderr
);
PQreset
(
pset
.
db
);
if
(
PQstatus
(
pset
.
db
)
==
CONNECTION_BAD
)
{
fputs
(
"Failed.
\n
"
,
stderr
);
PQfinish
(
pset
.
db
);
PQclear
(
res
);
pset
.
db
=
NULL
;
SetVariable
(
pset
.
vars
,
"DBNAME"
,
NULL
);
SetVariable
(
pset
.
vars
,
"HOST"
,
NULL
);
SetVariable
(
pset
.
vars
,
"PORT"
,
NULL
);
SetVariable
(
pset
.
vars
,
"USER"
,
NULL
);
SetVariable
(
pset
.
vars
,
"ENCODING"
,
NULL
);
return
NULL
;
}
else
fputs
(
"Succeeded.
\n
"
,
stderr
);
}
if
(
res
&&
(
PQresultStatus
(
res
)
==
PGRES_COMMAND_OK
||
PQresultStatus
(
res
)
==
PGRES_TUPLES_OK
||
PQresultStatus
(
res
)
==
PGRES_COPY_IN
||
...
...
@@ -351,6 +325,31 @@ PSQLexec(const char *query)
{
psql_error
(
"%s"
,
PQerrorMessage
(
pset
.
db
));
PQclear
(
res
);
if
(
PQstatus
(
pset
.
db
)
==
CONNECTION_BAD
)
{
if
(
!
pset
.
cur_cmd_interactive
)
{
psql_error
(
"connection to server was lost
\n
"
);
exit
(
EXIT_BADCONN
);
}
fputs
(
"The connection to the server was lost. Attempting reset: "
,
stderr
);
PQreset
(
pset
.
db
);
if
(
PQstatus
(
pset
.
db
)
==
CONNECTION_BAD
)
{
fputs
(
"Failed.
\n
"
,
stderr
);
PQfinish
(
pset
.
db
);
pset
.
db
=
NULL
;
SetVariable
(
pset
.
vars
,
"DBNAME"
,
NULL
);
SetVariable
(
pset
.
vars
,
"HOST"
,
NULL
);
SetVariable
(
pset
.
vars
,
"PORT"
,
NULL
);
SetVariable
(
pset
.
vars
,
"USER"
,
NULL
);
SetVariable
(
pset
.
vars
,
"ENCODING"
,
NULL
);
}
else
fputs
(
"Succeeded.
\n
"
,
stderr
);
}
return
NULL
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment