Re: extend pgbench expressions with functions

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: extend pgbench expressions with functions
Дата
Msg-id alpine.DEB.2.10.1602111835540.6591@sto
обсуждение исходный текст
Ответ на Re: extend pgbench expressions with functions  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: extend pgbench expressions with functions  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
Hello Michaël,

> +    /* the argument list has been built in reverse order, it is fixed here */
> +    expr->u.function.args = reverse_elist(args);
> Hm. I may be missing something, but why is that necessary? This is
> basically doing a double-reversion to put all the arguments in the
> correct order when parsing the function arguments.

This is because the expression list is parsed left to right and the list 
is built as a stack to avoid looking for the last argument to append the 
next expression, but then the list is in reverse order at the end of 
parsing, so it is reversed once to make it right. This way the complexity 
is kept as O(n).

If this is too much I can switch to O(n**2) by appending each expression 
at the end of the list.

-- 
Fabien.

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: GinPageIs* don't actually return a boolean
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: pl/pgsql exported functions