projects
/
users
/
hanada
/
postgres.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c52910d
)
Fix to check the result of connection attempt.
author
Shigeru Hanada
<
[email protected]
>
Fri, 1 Oct 2010 07:36:59 +0000
(16:36 +0900)
committer
Shigeru Hanada
<
[email protected]
>
Fri, 1 Oct 2010 07:36:59 +0000
(16:36 +0900)
contrib/postgresql_fdw/postgresql_fdw.c
patch
|
blob
|
blame
|
history
diff --git
a/contrib/postgresql_fdw/postgresql_fdw.c
b/contrib/postgresql_fdw/postgresql_fdw.c
index 77fc107339ed979bfa32c484cd125debd7cd276d..fce9bcb4634ac1392ff85427fb835ba26d2bbe39 100644
(file)
--- a/
contrib/postgresql_fdw/postgresql_fdw.c
+++ b/
contrib/postgresql_fdw/postgresql_fdw.c
@@
-125,6
+125,11
@@
pgConnectServer(ForeignServer *server, UserMapping *user)
/* verify connection parameters and do connect */
check_conn_params(keywords, values);
conn = PQconnectdbParams(keywords, values, 0);
+ if (!conn || PQstatus(conn) != CONNECTION_OK)
+ ereport(ERROR,
+ (errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
+ errmsg("could not connect to server"),
+ errdetail("%s", PQerrorMessage(conn))));
pfree(keywords);
pfree(values);