Hi
On postgresql 6.4.2 running on digital unix 4.0d. This bit of code
--------- pfunc.c-----------
/*
cc -c -I/usr/local/pgsql/include pfunc.c
ld -shared -expect_unresolved '*' -o pfunc.so pfunc.o
cc -o pfunc -I/usr/local/pgsql/include pfunc.c
create function int10() returns int4 as '/path/pfunc.so' LANGUAGE 'c';
create function float10() returns float4 as '/path/pfunc.so' LANGUAGE 'c';
select int10(),10::int4,float10(),10::float4;
*/
#include <stdio.h>
#include "postgres.h" /* for char16, etc. */
int4 int10() {
return (int4) 10;
}
float4 float10() {
return (float4) 10.0;
}
----------------------------
does
dbase=> select int10(),10,float10(),10.0;
int10|?column?|float10|?column?
-----+--------+-------+--------
10| 10|2.27828| 10
(1 row)
dbase=> select int10(),10,float10(),10.0;
int10|?column?|float10|?column?
-----+--------+-------+--------
10| 10|2.27812| 10
(1 row)
Note that float10() gives different answers at different times.
--
+-----------------+------------------------------------------+
| _ ^ _ | Dr. Rodney McDuff |
| |\ /|\ /| | Network Development, ITS |
| \ | / | The University of Queensland |
| \ | / | St. Lucia, Brisbane |
| \|/ | Queensland, Australia. 4072. |
|<-------+------->| TELEPHONE: +61 7 3365 8220 |
| /|\ | FACSIMILE: +61 7 3365 4477 |
| / | \ | EMAIL: mcduff@its.uq.edu.au |
| / | \ | |
| |/ \|/ \| | Ex ignorantia ad sapientiam |
| - v - | Ex luce ad tenebras |
+-----------------+------------------------------------------+