Re: psql: show only failed queries
От | Pavel Stehule |
---|---|
Тема | Re: psql: show only failed queries |
Дата | |
Msg-id | CAFj8pRA3wW3MWudk-M8XZAxfiWWCOtUxGtiprtc+UHxLh4H=uQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: psql: show only failed queries (Pavel Stehule <pavel.stehule@gmail.com>) |
Ответы |
Re: psql: show only failed queries
|
Список | pgsql-hackers |
Hello
updated patch - only one change: query is prefixed by "QUERY: "[pavel@localhost ~]$ src/postgresql/src/bin/psql/psql postgres -q -f data.sql
psql:data.sql:6: ERROR: value too long for type character varying(3)
[pavel@localhost ~]$ src/postgresql/src/bin/psql/psql postgres -q -v ECHO=error -f data.sql
psql:data.sql:6: ERROR: value too long for type character varying(3)
QUERY: INSERT INTO bubu VALUES('Ahoj');
2014-03-04 8:52 GMT+01:00 Pavel Stehule <pavel.stehule@gmail.com>:
2014-03-04 6:35 GMT+01:00 Fabrízio de Royes Mello <fabriziomello@gmail.com>:The patch works fine, but I think we must add some prefix to printed query. Like that:
On Sat, Mar 1, 2014 at 8:01 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
>
> Hello
>
> I was asked, how can be showed only failed queries in psql.
>
> I am thinking, so it is not possible now. But implementation is very simple
>
> What do you think about it?
>
> bash-4.1$ psql postgres -v ECHO=error -f data.sql
> INSERT 0 1
> Time: 27.735 ms
> INSERT 0 1
> Time: 8.303 ms
> psql:data.sql:3: ERROR: value too long for type character varying(2)
> insert into foo values('bbb');
> Time: 0.178 ms
> INSERT 0 1
> Time: 8.285 ms
> psql:data.sql:5: ERROR: value too long for type character varying(2)
> insert into foo values('ssssss');
> Time: 0.422 ms
>
fabrizio=# \set ECHO error
fabrizio=# insert into foo values ('XXX');DETAIL: insert into foo values ('XXX');
ERROR: value too long for type character varying(2)or
fabrizio=# \set ECHO error
fabrizio=# insert into foo values ('XXX');QUERY: insert into foo values ('XXX');
ERROR: value too long for type character varying(2)This may help to filter the output with some tool like 'grep'.sure, good idea.I add link to your notice to commitfest appRegards
Pavel
Regards,--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
Вложения
В списке pgsql-hackers по дате отправления: