Skip to content

Commit 3639071

Browse files
committed
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.
1 parent 2742c45 commit 3639071

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

contrib/dblink/dblink.c

+18-8
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,21 @@ dblink_get_conn(char *conname_or_str,
207207
* ensures that VFDs are closed if needed to make room.)
208208
*/
209209
if (!AcquireExternalFD())
210+
{
211+
#ifndef WIN32 /* can't write #if within ereport() macro */
210212
ereport(ERROR,
211213
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
212214
errmsg("could not establish connection"),
213215
errdetail("There are too many open files on the local server."),
214-
#ifndef WIN32
215-
errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")
216+
errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")));
216217
#else
217-
errhint("Raise the server's max_files_per_process setting.")
218+
ereport(ERROR,
219+
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
220+
errmsg("could not establish connection"),
221+
errdetail("There are too many open files on the local server."),
222+
errhint("Raise the server's max_files_per_process setting.")));
218223
#endif
219-
));
224+
}
220225

221226
/* OK to make connection */
222227
conn = PQconnectdb(connstr);
@@ -310,16 +315,21 @@ dblink_connect(PG_FUNCTION_ARGS)
310315
* that VFDs are closed if needed to make room.)
311316
*/
312317
if (!AcquireExternalFD())
318+
{
319+
#ifndef WIN32 /* can't write #if within ereport() macro */
313320
ereport(ERROR,
314321
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
315322
errmsg("could not establish connection"),
316323
errdetail("There are too many open files on the local server."),
317-
#ifndef WIN32
318-
errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")
324+
errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")));
319325
#else
320-
errhint("Raise the server's max_files_per_process setting.")
326+
ereport(ERROR,
327+
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
328+
errmsg("could not establish connection"),
329+
errdetail("There are too many open files on the local server."),
330+
errhint("Raise the server's max_files_per_process setting.")));
321331
#endif
322-
));
332+
}
323333

324334
/* OK to make connection */
325335
conn = PQconnectdb(connstr);

contrib/postgres_fdw/connection.c

+10-4
Original file line numberDiff line numberDiff line change
@@ -269,17 +269,23 @@ connect_pg_server(ForeignServer *server, UserMapping *user)
269269
* ensures that VFDs are closed if needed to make room.)
270270
*/
271271
if (!AcquireExternalFD())
272+
{
273+
#ifndef WIN32 /* can't write #if within ereport() macro */
272274
ereport(ERROR,
273275
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
274276
errmsg("could not connect to server \"%s\"",
275277
server->servername),
276278
errdetail("There are too many open files on the local server."),
277-
#ifndef WIN32
278-
errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")
279+
errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")));
279280
#else
280-
errhint("Raise the server's max_files_per_process setting.")
281+
ereport(ERROR,
282+
(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
283+
errmsg("could not connect to server \"%s\"",
284+
server->servername),
285+
errdetail("There are too many open files on the local server."),
286+
errhint("Raise the server's max_files_per_process setting.")));
281287
#endif
282-
));
288+
}
283289

284290
/* OK to make connection */
285291
conn = PQconnectdbParams(keywords, values, false);

0 commit comments

Comments
 (0)