somebody could explain this?

Поиск
Список
Период
Сортировка
От Cristian Prieto
Тема somebody could explain this?
Дата
Msg-id 008901c5e15b$2a0b14d0$6500a8c0@gt.ClickDiario.local
обсуждение исходный текст
Ответы Re: somebody could explain this?  (Martijn van Oosterhout <kleptog@svana.org>)
Re: somebody could explain this?  (Andrew Dunstan <andrew@dunslane.net>)
Re: somebody could explain this?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: somebody could explain this?  (Csaba Nagy <nagy@ecircle-ag.com>)
Список pgsql-hackers
Hello, I'm using PostgreSQL 8.0.4 in Fedora Core 3, right now I'm learning a
little about the postgresql internals and the way some kind of SPs could be
written in c language; I found something really weird and I cannot explain
to me this behavior:

#include "postgres.h"
#include "fmgr.h"

PG_FUNCTION_INFO_V1(test);

Datum
repeat_item(PG_FUNCTION_ARGS)
{int num_times;num_times = PG_GETARG_FLOAT8(0) * 100;PG_RETURN_INT32(num_times);
}


Inside psql this happens:

# Create or replace function test(float) returns integer as 'test.so'
language 'c' stable;

select test(0.1);
Returns 10

Select test(0.11);
Returns 11

Select test(0.12)
Returns 11

Select test(0.13)
Returns 13

Select test(0.14)
Returns 14

Select test(0.15)
Returns 14


What Is happening here?



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

Предыдущее
От: Cedric Berger
Дата:
Сообщение: postgresql-8.1RC1 on Solaris 10, amd64x2
Следующее
От: Tom Lane
Дата:
Сообщение: PG 8.1 supported platforms list: IRIX is MIA