]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix compile failure.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 24 Feb 2020 23:43:23 +0000 (18:43 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 24 Feb 2020 23:43:40 +0000 (18:43 -0500)
I forgot that some compilers won't handle #if constructs within
ereport() calls.  Duplicating most of the call is annoying but simple.
Per buildfarm.

contrib/dblink/dblink.c
contrib/postgres_fdw/connection.c

index 5a370e80b334a1aaf5af7a8a2f75afb5df19869a..2fe5da22b9ae4108cde042b209842e3d0468a70c 100644 (file)
@@ -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);
index a151c2c653f7b3510cd51352ce145e11a24e5519..e45647f3eafec1059a514b93976422fb8d210388 100644 (file)
@@ -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);