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

Поиск
Список
Период
Сортировка
От RISKO Gergely
Тема funny (cache (?)) bug in postgres (7.x tested)
Дата
Msg-id 20010628213918.A18977@atom.hu
обсуждение исходный текст
Ответы Re: funny (cache (?)) bug in postgres (7.x tested)  (Jan Wieck <JanWieck@Yahoo.com>)
Re: funny (cache (?)) bug in postgres (7.x tested)  (Alex Pilosov <alex@pilosoft.com>)
Re: funny (cache (?)) bug in postgres (7.x tested)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello!

I found a funny bug in postgres with c functions. (or feature??)
Let's say we have got an function like this:
CREATE FUNCTION hupper(text)
RETURNS text
AS '/fun.so'
LANGUAGE 'c';

and fun.c:
#include <postgresql/postgres.h>
#include <postgresql/utils/elog.h>
#include <postgresql/libpq/libpq-fs.h>

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='Ú';
elseif (ch=='ű') ch='Ű';       else if (ch=='ü') ch='Ü';       a->vl_dat[i]=ch;   }
 
   return a;
}

We use this to make hungarian upper (=Hupper).
And two select:
gergo=> select mire from mamapenz;mire
-------betetebedebedebedebedebed
(6 rows)

gergo=> select hupper(mire) from mamapenz;hupper
--------BETETEBEDEBEDEBEDEBEDEBED
(6 rows)

this is good, and now:
gergo=> select mire from mamapenz;        ^^^^^^^^^^^^^^^^^^^^^mire
-------BETETEBEDEBEDEBEDEBEDEBED
(6 rows)

After once hupper run on the table it will be upper case even I don't use hupper.
It can be fixed with a postgres restart or with 10-20 minutes of waiting.

If this is documented, sorry (but please point out where).

Thanks,
RISKO Gergely



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ilan Fait
Дата:
Сообщение: examine the PostgerSQL database
Следующее
От: alavoor
Дата:
Сообщение: Most intelligent database technique: For PostgreSQL and MySQL