ECPG doesn't delete its output file in case of an error

Поиск
Список
Период
Сортировка
От Boszormenyi Zoltan
Тема ECPG doesn't delete its output file in case of an error
Дата
Msg-id 4BB76B4F.9050509@cybertec.at
обсуждение исходный текст
Ответ на Re: Problems with variable cursorname in ecpg  (Boszormenyi Zoltan <zb@cybertec.at>)
Список pgsql-hackers
Hi,

I saw you changed my "warn about hidden vars" patch
to ET_ERROR instead of ET_FATAL. My thinking in using
ET_FATAL was that this is an error level that immedately
quits processing and deletes its output file. However,
you are right that we might want to report all such errors
in one run of ECPG.

But if ET_ERROR is used, the output file stays there as if
there was no error. Think about a project that uses Makefile
with say:
    .PRECIOUS: %.c
to keep the generated C sources by ECPG. However, the implicit
thinking is that the files were correctly generated.

In such a case, GNU make won't delete the generated file,
and ECPG won't be called the next time "make" is run as
the *.c file already exists (make won't know that ECPG reported
an error code last time) and the C compiler will be called.
directly. GCC on the other hand, deletes its object file
in case of an error (it also reports as many errors as it can),
so running make next time won't attempt linking to a bad
object file.

Attached is the patch to delete the output file if an error
happened. Comments?

Best regards,
Zoltán Böszörményi

--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/




Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: pgindent cleanup
Следующее
От: Robert Haas
Дата:
Сообщение: Re: message clarifications