@@ -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 );
0 commit comments