Re: funny (cache (?)) bug in postgres (7.x tested)

From: Doug McNaught <doug(at)wireboard(dot)com>
To: RISKO Gergely <risko(at)atom(dot)hu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: funny (cache (?)) bug in postgres (7.x tested)
Date: 2001-07-03 20:01:30
Message-ID: m3ae2lbx45.fsf@belphigor.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

RISKO Gergely <risko(at)atom(dot)hu> writes:

> text *hupper (text *a) {
> int hossz,i;
>
> hossz=a->vl_len;
> for (i=0;i<hossz;i++)
> {
> char ch;
> ch=a->vl_dat[i];
> if ((ch>=97)&(ch<=122)) ch=ch-32;
> else if (ch=='á') ch='Á';
> else if (ch=='é') ch='É';
> else if (ch=='í') ch='Í';
> else if (ch=='ó') ch='Ó';
> else if (ch=='õ') ch='Õ';
> else if (ch=='ö') ch='Ö';
> else if (ch=='ú') ch='Ú';
> else if (ch=='û') ch='Û';
> else if (ch=='ü') ch='Ü';
> a->vl_dat[i]=ch;
> }
>
> return a;
> }

I think you need to allocate a new TEXT datum and return it. You're
modifying the cached data in place, which is a no-no AFAIK.

-Doug
--
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time... --Dylan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2001-07-03 20:07:01 Re: New SQL Datatype RECURRINGCHAR
Previous Message Mikheev, Vadim 2001-07-03 19:55:47 RE: Re: Backup and Recovery