Re: Open 7.3 items

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Open 7.3 items
Дата
Msg-id 3D5A644C.9090607@joeconway.com
обсуждение исходный текст
Ответ на Re: Open 7.3 items  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: Open 7.3 items
Список 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@domain.com','@'), split_after('user@domain.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
characterto 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



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Inheritance
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Open 7.3 items