On Thu, 28 Jun 2001, RISKO Gergely wrote:
> 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;
> }
(Rest snipped).
You are not supposed to write directly to the argument you are given. You
must construct a new text value (by allocating space via palloc) and
copy your string there. By overwriting existing values, you potentially
corrupt postgres' cache, resulting in your behaviour.