Re: Pg default's verbosity? - Mailing list pgsql-hackers
From | Bruce Momjian |
---|---|
Subject | Re: Pg default's verbosity? |
Date | |
Msg-id | 20120830214344.GB32350@momjian.us Whole thread Raw |
In response to | Re: Pg default's verbosity? (nik9000@gmail.com) |
List | pgsql-hackers |
On Sun, Jun 17, 2012 at 12:00:20AM -0400, nik9000@gmail.com wrote: > I've always used -1-f - < file.sql. It is confusing that -1 doesn't warn you when it wont work though. This will be fixed in 9.3 with this commit: commit be690e291d59e8d0c9f4df59abe09f1ff6cc0da9Author: Robert Haas <rhaas@postgresql.org>Date: Thu Aug 9 09:59:45 2012-0400 Make psql -1 < file behave as expected. Previously, the -1 option was silently ignored. Also, emit anerror if -1 is used in a context where it won't be respected, to avoid user confusion. Original patch by Fabien COELHO,but this version is quite different from the original submission. --------------------------------------------------------------------------- > > Sent from my iPhone > > On Jun 16, 2012, at 3:42 AM, Fabien COELHO <coelho@cri.ensmp.fr> wrote: > > > > > Hello pgdev, > > > > (Second attempt) > > > > I've conducted a statistical study about PostgreSQL use in OSS. One of the result is that quite a few projects have errorsin their SQL setup scripts which lead to some statements to be ignored, typically somme ADD CONSTRAINTS which do notchange the database schema from a functional point of view, or syntactic errors (typically a mysql syntax...) that > > result in missing tables, but which are not found if the application is not fully tested. > > > > I think that there are two reasons why these errors are not caught by application developers: > > > > (1) the default verbosity is set to "notice", which is much to high. The users just get used to seeing a lot of messageson loading an sql script, and to ignore them, so that errors are just hidden in the flow of notices. I think thata better default setting would be "warnings", that is messages that require some attention from the developer. > > > > (2) the default behavior of psql on errors is to keep going. Developers of SQL script that are expected to work shoudbe advised to: > > - encourage application devs to set ON_ERROR_STOP and/or use a global > > transaction in their script. > > - provide a simple/short option to do that from the command line > > basically that could be an enhanced "-1", NOT restricted > > to "-f" but that would work on standard input as well. > > > > sh> psql -1 -f setup.sql # -1 does work here > > sh> psql -1 < setup.sql # -1 does not apply to stdin stuff... > > > > > > So I would suggest the following todos: > > > > 1 - change the default verbosity to "warning". > > > > 2 - change -1 to work on stdin as well instead of being ignored, > > or provide another option that would do that. > > > > -- > > Fabien Coelho - coelho@cri.ensmp.fr > > > > -- > > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > > To make changes to your subscription: > > http://www.postgresql.org/mailpref/pgsql-hackers > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers -- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. +
pgsql-hackers by date: