Well yes, the fact you're asking is surprising.
void PQclear(PGresult* res);
How could it? C/C++ is pass by value. So PQclear gets a copy of the pointer.
Even if it assigns it internal to nullptr, the calling code has its
own unchanged copy.
It's the same reason free() doesn't either.
It's your responsability to assign nullptr after the PQclear.
In/out argument in general violate the Principle of Least Surprise,
and are best avoided.
You have no way to know reading the code the call has a side effect on
the var (as opposed to the value). FWIW. --DD