From: | Craig Ringer <craig(at)2ndquadrant(dot)com> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: New developer TODO suggestions |
Date: | 2014-09-18 09:30:38 |
Message-ID: | 541AA63E.9070302@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 07/29/2014 10:43 PM, Bruce Momjian wrote:
>> > * When a user tries to run "psql -f some_custom_format_backup", detect
>> > this and emit a useful error message. Ditto stdin.
>
> Uh, good idea, but can we really do that in psql?
Where stdin is a file, or an explicit -f is given, then yes.
Just look for PGDMP as the first five bytes and complain.
To do it more generally we'd need to look at each statement and see if
it seems to begin with PGDMP. I'm not sure that's worth it; handling the
simple cases of
psql -f mydb.dump
and
psql < mydb.dump
would be quite sufficient.
I'm not 100% sure if we can easily differentiate the second case from
"pg_dump | psql"; I know there's isatty(...) to test if stdin is a
terminal, but I'm not sure how easy/possible it is to tell if it's a
file not a pipe.
pg_restore already knows to tell you to use psql if it sees an SQL file
as input. Having something similar for pg_dump would be really useful.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2014-09-18 09:58:20 | Re: New developer TODO suggestions |
Previous Message | Dev Kumkar | 2014-09-18 09:11:07 | Re: pg_multixact issues |