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