Обсуждение: Bug in execute.c

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

Bug in execute.c

От
Christian Ullrich
Дата:
 From execute.c, SC_setInsertedTable(), line 790:

    if (ptr = strchr(cmd + 1, '.'), NULL != ptr)
        len = ptr - cmd;

This branch is supposed to extract an unquoted schema name from an
INSERT statement. If that statement is

    INSERT INTO mytable VALUES (1, 1.5)

, the schema name will be "mytable VALUES (1, 1", and the table name, "5)".

I'm sorry I don't have a patch right now. I can come up with one, though.

--
Christian

Re: Bug in execute.c

От
Christian Ullrich
Дата:
* Christian Ullrich wrote:

>  From execute.c, SC_setInsertedTable(), line 790:
>
>      if (ptr = strchr(cmd + 1, '.'), NULL != ptr)
>          len = ptr - cmd;

> I'm sorry I don't have a patch right now. I can come up with one, though.

Patch attached. It may be a bit over the top. Please let me know what
you think.

--
Christian


Вложения

Re: Bug in execute.c

От
Heikki Linnakangas
Дата:
On 04/24/2015 10:48 AM, Christian Ullrich wrote:
> * Christian Ullrich wrote:
>
>>   From execute.c, SC_setInsertedTable(), line 790:
>>
>>       if (ptr = strchr(cmd + 1, '.'), NULL != ptr)
>>           len = ptr - cmd;
>
>> I'm sorry I don't have a patch right now. I can come up with one, though.
>
> Patch attached. It may be a bit over the top. Please let me know what
> you think.

Thanks, applied! I also added a little regression test for this. I
didn't try testing it exhaustively to see what kind of things would
still trip it over (comments? newlines?), but this is certainly a step
in the right direction. Well, it would be better to not have to do this
parsing, but that's no reason to not improve what we have.

- Heikki