Re: String manipulation

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: String manipulation
Дата
Msg-id 17030.1059441673@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: String manipulation  (Joe Conway <mail@joeconway.com>)
Список pgsql-novice
Joe Conway <mail@joeconway.com> writes:
> SELECT substring(path from position(' ' in path) + 1) FROM (SELECT
> split_part( path, ':', 2 ) AS path FROM paths) AS ss;

> I could be wrong but I was thinking it would be more efficient to only
> calculate the function once.

Actually, the only thing you saved was writing out the split_part call
twice --- when the planner flattens the sub-select it expands each
reference to a sub-select output, so the split_part ends up getting
evaluated twice anyway.  But the notational savings can be useful.

            regards, tom lane

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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: String manipulation
Следующее
От: "psql novice"
Дата:
Сообщение: Retrieving NULL records