Re: [HACKERS] Fix in oracle_compat.c

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: jwieck(at)debis(dot)com
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Fix in oracle_compat.c
Date: 1998-08-11 18:38:02
Message-ID: 199808111838.OAA24783@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Patch applied.

> Hi,
>
> the following patch fixes a bug in the oracle compatibility
> functions btrim() ltrim() and rtrim().
>
> The error was that the character after the set was included
> in the tests (ptr2 pointed to the character after the vardata
> part of set if no match found, so comparing *ptr or *end
> against *ptr2 MAY match -> strip).
>
>
> Jan
>
> --
>
> #======================================================================#
> # It's easier to get forgiveness for being wrong than for being right. #
> # Let's break this rule - forgive me. #
> #======================================== jwieck(at)debis(dot)com (Jan Wieck) #
>
>
> *** oracle_compat.c.orig Tue Aug 11 16:07:48 1998
> --- oracle_compat.c Tue Aug 11 16:08:37 1998
> ***************
> *** 297,303 ****
> break;
> ++ptr2;
> }
> ! if (*ptr != *ptr2)
> break;
> ptr++;
> ptr2 = VARDATA(set);
> --- 297,303 ----
> break;
> ++ptr2;
> }
> ! if (ptr2 > end2)
> break;
> ptr++;
> ptr2 = VARDATA(set);
> ***************
> *** 316,322 ****
> break;
> ++ptr2;
> }
> ! if (*end != *ptr2)
> break;
> --end;
> ptr2 = VARDATA(set);
> --- 316,322 ----
> break;
> ++ptr2;
> }
> ! if (ptr2 > end2)
> break;
> --end;
> ptr2 = VARDATA(set);
> ***************
> *** 374,380 ****
> break;
> ++ptr2;
> }
> ! if (*ptr != *ptr2)
> break;
> ptr++;
> ptr2 = VARDATA(set);
> --- 374,380 ----
> break;
> ++ptr2;
> }
> ! if (ptr2 > end2)
> break;
> ptr++;
> ptr2 = VARDATA(set);
> ***************
> *** 434,440 ****
> break;
> ++ptr2;
> }
> ! if (*ptr != *ptr2)
> break;
> --ptr;
> ptr2 = VARDATA(set);
> --- 434,440 ----
> break;
> ++ptr2;
> }
> ! if (ptr2 > end2)
> break;
> --ptr;
> ptr2 = VARDATA(set);
>
>

--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-08-11 19:12:18 partial index
Previous Message Bruce Momjian 1998-08-11 18:35:57 Re: [HACKERS] Indexes bug