Обсуждение: initcap incompatibility issue
The initcap function is not completely consistent with Oracle's initcap
function:
SELECT initcap('alex hyde-whyte');
In Oracle 9.2i this will return 'Alex Hyde-White', in PostgreSQL 7.3.3
it returns 'Alex Hyde-white'.
It looks like a relatively simple change to oracle_compat.c in
backend/utils/adt, but is this a bugfix that can be made during the
pre-beta period for 7.4 or does it need to wait?
--
Mike Nolan
>
> The initcap function is not completely consistent with Oracle's initcap
> function:
>
> SELECT initcap('alex hyde-whyte');
>
> In Oracle 9.2i this will return 'Alex Hyde-White', in PostgreSQL 7.3.3
> it returns 'Alex Hyde-white'.
No, it doesn't change the 'y' to an 'i', that's a typo in my earlier
note. As far as I can tell, not capitalizing the first letter after a dash
is the only inconsistency with Oracle's implementation of this function.
If a patch is in order at this time, I will try to produce it, I need to
learn set up CVS and how to do that anyway. :-)
--
Mike Nolan
> As far as I can tell, not capitalizing the first letter after a dash > is the only inconsistency with Oracle's implementation of this function. Wrong again. Oracle also capitalizes the first letter after a comma, semicolon, colon, period, and both a single and double quote. (And that's all I've tested so far.) So, I guess I need to write a program to test all possible combinations to see how incompatible the function is. Making this change will be a larger patch than I had initially anticipated. That also brings into question whether this is really a bugfix or a specification change, a question which is relevant since we're in the feature freeze for 7.4. -- Mike Nolan
On Wed, 9 Jul 2003 nolan@celery.tssi.com wrote: > > As far as I can tell, not capitalizing the first letter after a dash > > is the only inconsistency with Oracle's implementation of this function. > > Wrong again. Oracle also capitalizes the first letter after a comma, > semicolon, colon, period, and both a single and double quote. (And that's > all I've tested so far.) > > So, I guess I need to write a program to test all possible combinations > to see how incompatible the function is. > > Making this change will be a larger patch than I had initially anticipated. > > That also brings into question whether this is really a bugfix or a > specification change, a question which is relevant since we're in the > feature freeze for 7.4. It sounds like Oracle is simply regexing for anything that ISN'T a letter to initcap right after it. If that's the case, you could just regex too.
"scott.marlowe" <scott.marlowe@ihs.com> writes:
> On Wed, 9 Jul 2003 nolan@celery.tssi.com wrote:
>> Wrong again. Oracle also capitalizes the first letter after a comma,
>> semicolon, colon, period, and both a single and double quote. (And that's
>> all I've tested so far.)
> It sounds like Oracle is simply regexing for anything that ISN'T a letter
> to initcap right after it. If that's the case, you could just regex too.
Or more likely, use the appropriate ctype.h function (isalpha, probably).
>> That also brings into question whether this is really a bugfix or a
>> specification change, a question which is relevant since we're in the
>> feature freeze for 7.4.
AFAIK, our specification for this function is "be like Oracle", so it's
a bug fix and fair game for 7.4. Of course, the sooner you get it in
the more likely we'll see it that way ;-). Later in beta, only critical
bugfixes will be accepted, and this one surely ain't very critical.
regards, tom lane
> > It sounds like Oracle is simply regexing for anything that ISN'T a letter > > to initcap right after it. If that's the case, you could just regex too. > > Or more likely, use the appropriate ctype.h function (isalpha, probably). Having tested it, Oracle capitalizes after all non-alphanumeric characters, so !isalnum() is the appropriate function. (That makes it a one-line patch on 7.3.3, which I've already tested.) > AFAIK, our specification for this function is "be like Oracle", so it's > a bug fix and fair game for 7.4. Of course, the sooner you get it in > the more likely we'll see it that way ;-). Later in beta, only critical > bugfixes will be accepted, and this one surely ain't very critical. Now if I can just get CVS working on Redhat 8 and remember how to build a patch, even a one-liner. :-) -- Mike Nolan