Re: String manipulation - Mailing list pgsql-novice

From Joe Conway
Subject Re: String manipulation
Date
Msg-id 3F25A9CC.2050402@joeconway.com
Whole thread Raw
In response to Re: String manipulation  ("David Olbersen" <DOlbersen@stbernard.com>)
List pgsql-novice
David Olbersen wrote:
> I have an *UGLY* solution that might give you or others some ideas...
>
> SELECT
>   substring(
>     split_part( path, ':', 2 )
>     from
>     position( ' ' in split_part( path, ':', 2 ) ) + 1
>   )
> FROM paths;
>

That solution was pretty much what I was thinking. An alternative:

SELECT substring(path from position(' ' in path) + 1)
FROM (SELECT split_part( path, ':', 2 ) AS path FROM paths) AS ss;

Joe


pgsql-novice by date:

Previous
From: Bryan Irvine
Date:
Subject: auto-counting tables
Next
From: "David Olbersen"
Date:
Subject: Re: String manipulation