CreateEventTrigStmt copy fix

Поиск
Список
Период
Сортировка
Искать

CreateEventTrigStmt copy fix

От:
Petr Jelinek <petr@2ndquadrant.com>
Дата:
Вложения:
Hi hackers,

I was trying to create event trigger inside DO statement inside an 
extension SQL script and noticed that the new event trigger has empty 
evtevent field.
After some tinkering with gdb I found out that the memory context 
switches sometimes clear the eventname in CreateEventTrigStmt struct. 
The reason for this is that _copyCreateEventTrigStmt uses 
COPY_SCALAR_FIELD on eventname instead of COPY_STRING_FIELD.

Attached patch fixes this and also the same issue in 
_equalCreateEventTrigStmt.

This should be back-patched to 9.3 where event triggers were introduced.

-- 
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services

Re: CreateEventTrigStmt copy fix

От:
Michael Paquier <michael.paquier@gmail.com>
Дата:
On Fri, Sep 19, 2014 at 11:09 AM, Petr Jelinek  wrote:
> Hi hackers,
>
> I was trying to create event trigger inside DO statement inside an extension
> SQL script and noticed that the new event trigger has empty evtevent field.
> After some tinkering with gdb I found out that the memory context switches
> sometimes clear the eventname in CreateEventTrigStmt struct. The reason for
> this is that _copyCreateEventTrigStmt uses COPY_SCALAR_FIELD on eventname
> instead of COPY_STRING_FIELD.
>
> Attached patch fixes this and also the same issue in
> _equalCreateEventTrigStmt.
>
> This should be back-patched to 9.3 where event triggers were introduced.
Nice catch! And no need to care much about outfuncs.c for this Node type.
Regards,
-- 
Michael


Re: CreateEventTrigStmt copy fix

От:
Robert Haas <robertmhaas@gmail.com>
Дата:
On Fri, Sep 19, 2014 at 12:09 PM, Petr Jelinek  wrote:
> I was trying to create event trigger inside DO statement inside an extension
> SQL script and noticed that the new event trigger has empty evtevent field.
> After some tinkering with gdb I found out that the memory context switches
> sometimes clear the eventname in CreateEventTrigStmt struct. The reason for
> this is that _copyCreateEventTrigStmt uses COPY_SCALAR_FIELD on eventname
> instead of COPY_STRING_FIELD.
>
> Attached patch fixes this and also the same issue in
> _equalCreateEventTrigStmt.
>
> This should be back-patched to 9.3 where event triggers were introduced.

Done, thanks.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


FAQ