Remove redundant pg_unreachable() after elog(ERROR) from ExecWaitStmt()
authorAlexander Korotkov <akorotkov@postgresql.org>
Tue, 20 Jan 2026 14:10:25 +0000 (16:10 +0200)
committerAlexander Korotkov <akorotkov@postgresql.org>
Tue, 20 Jan 2026 14:10:25 +0000 (16:10 +0200)
elog(ERROR) never returns.  Compilers don't always understand this.  So,
sometimes, we have to append pg_unreachable() to keep the compiler quiet
about returning from a non-void function without a value.  But
pg_unreachable() is redundant for ExecWaitStmt(), which is void.

Reported-by: Peter Eisentraut <peter@eisentraut.org>
Author: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/8d72a2b3-7423-4a15-a981-e130bf60b1a6%40eisentraut.org
Discussion: https://postgr.es/m/CABPTF7UcuVD0L-X%3DjZFfeygjPaZWWkVRwtWOaJw2tcXbEN2xsA%40mail.gmail.com

src/backend/commands/wait.c

index 97f1e7784883d65ff9e48d4161336fe097659197..1290df10c6f0c7d35fc9f287a7ee2eb3e3999a73 100644 (file)
@@ -236,7 +236,6 @@ ExecWaitStmt(ParseState *pstate, WaitStmt *stmt, DestReceiver *dest)
 
                    default:
                        elog(ERROR, "unexpected wait LSN type %d", lsnType);
-                       pg_unreachable();
                }
            }
            else
@@ -281,7 +280,6 @@ ExecWaitStmt(ParseState *pstate, WaitStmt *stmt, DestReceiver *dest)
 
                        default:
                            elog(ERROR, "unexpected wait LSN type %d", lsnType);
-                           pg_unreachable();
                    }
                }
                else
@@ -311,7 +309,6 @@ ExecWaitStmt(ParseState *pstate, WaitStmt *stmt, DestReceiver *dest)
 
                        default:
                            elog(ERROR, "unexpected wait LSN type %d", lsnType);
-                           pg_unreachable();
                    }
                }
            }