From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Sean Chittenden <sean(at)chittenden(dot)org> |
Cc: | Hannu Krosing <hannu(at)tm(dot)ee>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Open 7.3 items |
Date: | 2002-08-14 14:08:12 |
Message-ID: | 3D5A644C.9090607@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Sean Chittenden wrote:
> Agreed, but there is something to be said for doing a sort of users
> per domain. This wouldn't be an issue, I don't think, if there was a
> split_before() and split_after() like functions.
>
> # SELECT split_before('user(at)domain(dot)com','@'), split_after('user(at)domain(dot)com', '@');
> ?column? | ?column?
> ----------+------------
> user | domain.com
>
> What would you guys say to submissions for a patch that would add the
> function listed above? Maybe just a function called get_user(text)
> and get_domain(text)? ::shrug:: Just some thoughts since there is
> validity to being able to parse/operate on this data efficiently. If
> those functions existed, then I think everyone would be able to have
> their pie as they want it. -sc
>
I already have a function in contrib/dblink, currently called
dblink_strtok(), which I was going to turn into a builtin function per
recent discussion (renamed of course). It would work for this but is
more general:
dblink_strtok(text inputstring, text delimiter, int posn) RETURNS text
Inputs
inputstring
any string you want to parse a token out of;
e.g. 'f=1&g=3&h=4'
delimiter
a single character to use as the delimiter;
e.g. '&' or '='
posn
the position of the token of interest, 0 based;
e.g. 1
Should it be called splitstr() (similar to substr())?
Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2002-08-14 14:23:24 | Re: Open 7.3 items |
Previous Message | Tom Lane | 2002-08-14 13:59:15 | Re: Inheritance |