aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-02-24 18:43:23 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2020-02-24 18:43:40 -0500
commit36390713a60f446da7e7ae758771c9104fa89394 (patch)
treee68dfd42f30f9000fb39f698a64c8cf608bb5018
parent2742c45080077ed3b08b810bb96341499b86d530 (diff)
downloadpostgresql-36390713a60f446da7e7ae758771c9104fa89394.tar.gz
postgresql-36390713a60f446da7e7ae758771c9104fa89394.zip
Fix compile failure.
I forgot that some compilers won't handle #if constructs within ereport() calls. Duplicating most of the call is annoying but simple. Per buildfarm.
-rw-r--r--contrib/dblink/dblink.c26
-rw-r--r--contrib/postgres_fdw/connection.c14
2 files changed, 28 insertions, 12 deletions
diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c
index 5a370e80b33..2fe5da22b9a 100644
--- a/contrib/dblink/dblink.c
+++ b/contrib/dblink/dblink.c
@@ -207,16 +207,21 @@ dblink_get_conn(char *conname_or_str,
* ensures that VFDs are closed if needed to make room.)
*/
if (!AcquireExternalFD())
+ {
+#ifndef WIN32 /* can't write #if within ereport() macro */
ereport(ERROR,
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
errmsg("could not establish connection"),
errdetail("There are too many open files on the local server."),
-#ifndef WIN32
- errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")
+ errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")));
#else
- errhint("Raise the server's max_files_per_process setting.")
+ ereport(ERROR,
+ (errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
+ errmsg("could not establish connection"),
+ errdetail("There are too many open files on the local server."),
+ errhint("Raise the server's max_files_per_process setting.")));
#endif
- ));
+ }
/* OK to make connection */
conn = PQconnectdb(connstr);
@@ -310,16 +315,21 @@ dblink_connect(PG_FUNCTION_ARGS)
* that VFDs are closed if needed to make room.)
*/
if (!AcquireExternalFD())
+ {
+#ifndef WIN32 /* can't write #if within ereport() macro */
ereport(ERROR,
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
errmsg("could not establish connection"),
errdetail("There are too many open files on the local server."),
-#ifndef WIN32
- errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")
+ errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")));
#else
- errhint("Raise the server's max_files_per_process setting.")
+ ereport(ERROR,
+ (errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
+ errmsg("could not establish connection"),
+ errdetail("There are too many open files on the local server."),
+ errhint("Raise the server's max_files_per_process setting.")));
#endif
- ));
+ }
/* OK to make connection */
conn = PQconnectdb(connstr);
diff --git a/contrib/postgres_fdw/connection.c b/contrib/postgres_fdw/connection.c
index a151c2c653f..e45647f3eaf 100644
--- a/contrib/postgres_fdw/connection.c
+++ b/contrib/postgres_fdw/connection.c
@@ -269,17 +269,23 @@ connect_pg_server(ForeignServer *server, UserMapping *user)
* ensures that VFDs are closed if needed to make room.)
*/
if (!AcquireExternalFD())
+ {
+#ifndef WIN32 /* can't write #if within ereport() macro */
ereport(ERROR,
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
errmsg("could not connect to server \"%s\"",
server->servername),
errdetail("There are too many open files on the local server."),
-#ifndef WIN32
- errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")
+ errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")));
#else
- errhint("Raise the server's max_files_per_process setting.")
+ ereport(ERROR,
+ (errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
+ errmsg("could not connect to server \"%s\"",
+ server->servername),
+ errdetail("There are too many open files on the local server."),
+ errhint("Raise the server's max_files_per_process setting.")));
#endif
- ));
+ }
/* OK to make connection */
conn = PQconnectdbParams(keywords, values, false);