On Mon, 19 Jun 2023 at 04:52, jian he <jian.universal...@gmail.com> wrote: > > /* Now that it's closed we should get an error when describing */ > > res = PQdescribePortal(conn, "cursor_one"); > > if (PQresultStatus(res) != PGRES_FATAL_ERROR) > > pg_fatal("expected COMMAND_OK, got %s", PQresStatus(PQresultStatus(res))); > should it be "if (PQresultStatus(res) == PGRES_FATAL_ERROR)" ?
The check is correct, but the fatal message was incorrect here. We're intentionally expecting an error here, because that's the easiest way to see that the portal was closed.