Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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.

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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group