Re: [HACKERS] Please rename split(text,text,int) to splitpart

From: Joe Conway <mail(at)joeconway(dot)com>
To:
Cc: Hannu Krosing <hannu(at)tm(dot)ee>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] Please rename split(text,text,int) to splitpart
Date: 2002-09-07 19:45:13
Message-ID: 3D7A5749.2020908@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Joe Conway wrote:
> Hannu Krosing wrote:
>
>> It seems that my last mail on this did not get through to the list
>> ;(
>>
>> Please consider renaming the new builtin function
>> split(text,text,int)
>>
>> to something else, perhaps
>>
>> split_part(text,text,int)
>>
>> (like date_part)
>>
>> The reason for this request is that 3 most popular scripting
>> languages (perl, python, php) all have also a function with similar
>> signature, but returning an array instead of single element and the
>> (optional) third argument is limit (maximum number of splits to
>> perform)
>>
>> I think that it would be good to have similar function in (some
>> future release of) postgres, but if we now let in a function with
>> same name and arguments but returning a single string instead an
>> array of them, then we will need to invent a new and not so easy to
>> recognise name for the "real" split function.
>>
>
> This is a good point, and I'm not opposed to changing the name, but
> it is too bad your original email didn't get through before beta1 was
> rolled. The change would now require an initdb, which I know we were
> trying to avoid once beta started (although we could change it
> without *requiring* an initdb I suppose).
>
> I guess if we do end up needing an initdb for other reasons, we
> should make this change too. Any other opinions? Is split_part an
> acceptable name?
>
> Also, if we add a todo to produce a "real" split function that
> returns an array, similar to those languages, I'll take it for 7.4.

No one commented on the choice of name, so the attached patch changes
the name of split(text,text,int) to split_part(text,text,int) per
Hannu's recommendation above. This can be applied without an initdb if
current beta testers are advised to run:

update pg_proc set proname = 'split_part' where proname = 'split';

in the case they want to use this function. Regression and doc fix is
also included in the patch.

Please apply.

Thanks,

Joe

Attachment Content-Type Size
split-name-fix.1.patch text/plain 5.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message snpe 2002-09-07 20:09:45 Re: [JDBC] problem with new autocommit config parameter
Previous Message Bruno Wolff III 2002-09-07 19:32:40 Re: Making small bits of code available

Browse pgsql-patches by date

  From Date Subject
Next Message Serguei Mokhov 2002-09-07 21:48:17 Russian NLS Updates (pg_dump and postgres)
Previous Message Bruce Momjian 2002-09-07 18:38:43 Re: Some changes related to NAMEDATALEN 32->64