tushar <[email protected]> writes:
> So this query is a failed query and now if i give 'postgres' instead of
> 'abc123', Am I not supposed to get the same error , instead of
> pg_dump overwriting the postgres executable.

No.  You are supposed to be someone who knows better --- and if you
don't, you should not be running with write privileges on those
files.  pg_dump has absolutely no way to know that that particular
output file is something important.  Even if we tried to put that
knowledge into it, there are tiny variations of this case that
would still break, such as

        ./pg_dump ... >postgres

or for that matter

        echo oops >postgres

There is no point in trying to prevent pg_dump from overwriting a
postgres executable when there are thousands of other ways to do
that, if you're foolish enough to not be more careful with file
permissions.

                        regards, tom lane


Reply via email to