Re: Making psql error out on output failures

Поиск
Список
Период
Сортировка
Искать
От
David Zhang
Тема
Re: Making psql error out on output failures
Дата
Msg-id
b702d3c3-1bae-5a51-3f8b-925e944f78de@highgo.ca
Ответ на
Список
Дерево обсуждения
Making psql error out on output failures "Daniel Verite" <daniel@manitou-mail.org>
Re: Making psql error out on output failures David Z <idrawone@gmail.com>
Re: Making psql error out on output failures "Daniel Verite" <daniel@manitou-mail.org>
Re: Making psql error out on output failures David Zhang <david.zhang@highgo.ca>
Re: Making psql error out on output failures "Daniel Verite" <daniel@manitou-mail.org>
Re: Making psql error out on output failures David Zhang <david.zhang@highgo.ca>
Re: Making psql error out on output failures "Daniel Verite" <daniel@manitou-mail.org>
Re: Making psql error out on output failures David Zhang <david.zhang@highgo.ca>
Re: Making psql error out on output failures "Daniel Verite" <daniel@manitou-mail.org>
Re: Making psql error out on output failures David Zhang <david.zhang@highgo.ca>
Re: Making psql error out on output failures "Daniel Verite" <daniel@manitou-mail.org>
Re: Making psql error out on output failures David Zhang <david.zhang@highgo.ca>
Re: Making psql error out on output failures Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Making psql error out on output failures David Zhang <david.zhang@highgo.ca>
Re: Making psql error out on output failures "Daniel Verite" <daniel@manitou-mail.org>
Re: Making psql error out on output failures Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: Making psql error out on output failures "Daniel Verite" <daniel@manitou-mail.org>

On 2020-01-20 2:42 a.m., Daniel Verite wrote:
> 	David Zhang wrote:
>
>> Yes, I agree with you. For case 2 "select repeat('111', 1000000) \g
>> /mnt/ramdisk/file", it can be easily fixed with more accurate error
>> message similar to pg_dump, one example could be something like below.
>> But for case 1 "psql -d postgres  -At -c "select repeat('111', 1000000)"
>>> /mnt/ramdisk/file" , it may require a lot of refactoring work.
> I don't quite see why you make that distinction? The relevant bits of
> code are common, it's all the code in src/fe_utils/print.c called
> from PrintQuery().

The reason is that, within PrintQuery() function call, one case goes to 
print_unaligned_text(), and the other case goes to print_aligned_text(). 
The error "No space left on device" can be logged by fprintf() which is 
redefined as pg_fprintf() when print_aligned_text() is called, however 
the original c fputs function is used directly when 
print_unaligned_text() is called, and it is used everywhere.

Will that be a better solution if redefine fputs similar to fprintf and 
log the exact error when first time discovered? The concern is that if 
we can't provide a more accurate information to the end user when error 
happens, sometimes the end user might got even confused.

>
> Best regards,
-- 
David

Software Engineer
Highgo Software Inc. (Canada)
www.highgo.ca


В списке pgsql-hackers по дате отправления
От: Alvaro Herrera
Дата:
От: Mahendra Singh Thalor
Дата:
FAQ