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

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

From: Alex Pilosov <alex(at)pilosoft(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:26:38
Message-ID: Pine.BSO.4.10.10107031625150.18587-100000@spider.pilosoft.com (view raw or flat)
Thread:
Lists: pgsql-hackers
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.


In response to

pgsql-hackers by date

Next:From: Alex PilosovDate: 2001-07-03 20:32:21
Subject: Re: New SQL Datatype RECURRINGCHAR
Previous:From: Dmitry G. MastrukovDate: 2001-07-03 20:19:23
Subject: Re: Re: New data type: uniqueidentifier

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