Re: order by in for loop in plpgsql does not work

Поиск
Список
Период
Сортировка
От Jean-Luc Lachance
Тема Re: order by in for loop in plpgsql does not work
Дата
Msg-id 3DE51698.DFCC3CCD@nsd.ca
обсуждение исходный текст
Ответ на Re: order by in for loop in plpgsql does not work  ("Nigel J. Andrews" <nandrews@investsystems.co.uk>)
Список pgsql-general
Tom,

At first I was about to tell you that it did not make sense to use local
variable in the order by or group by clauses, but since they (order by -
group by) can take numerical arguments...

I understand perfectly now.
Thanks for the help.

JLL



Tom Lane wrote:
>
> "Nigel J. Andrews" <nandrews@investsystems.co.uk> writes:
> > I'd also say your problem was probably more due to how you are initialising
> > exchangeno and routeno variables to empty strings and then using those values
> > in the order by clause of the select.
>
> Yes, this is surely the issue: the 'exchangeno' and 'routeno' names in
> the ORDER BY clause are being replaced by the plpgsql vars of the same
> names.
>
> It's a bad idea to use plpgsql variable names that are the same as
> column names of tables that you use in the function...
>
>                         regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: query visibility - trigger order - bug?
Следующее
От: "Al Bean"
Дата:
Сообщение: versions