problem with floats

Started by Alex Carobusalmost 28 years ago4 messagesgeneral
Jump to latest
#1Alex Carobus
acarobus@atl.lmco.com

I was trying to use some c code to return floats to postgres but I keep getting
the following error :

template1=> select oner();
PQexec() -- Request was sent to backend, but backend closed the channel before
responding. This probably means the backend terminated abnormally before or
while processing the request.

The function is :
...
float8 oner() {return(1.0);}
...

And is created :
drop function oner();
DROP

create function oner() returns float8
as '/home/acarobus/postgres/f_los.so' language 'c';
CREATE

Does anyone know why this is happening? thanks for any help.

-Alex

#2Bruce Tong
zztong@laxmi.ev.net
In reply to: Alex Carobus (#1)
Re: [GENERAL] problem with floats

I was trying to use some c code to return floats to postgres but I keep
getting the following error :

template1=> select oner();
PQexec() -- Request was sent to backend, but backend closed the channel before
responding. This probably means the backend terminated abnormally before or
while processing the request.

From my (limited) experience, this message occurs when you fail to get a

connection to the database. I do not believe it has anything to do with
the floating point stuff you're trying, but probably more to do with your
call to PQsetdb(), environment variables, or entries in your pg_hba.conf
file.

I hope I'm not leading you in the wrong direction with this answer, but
that's what I'd be checking if I hadn't already.

Bruce Tong | Got me an office; I'm there late at night.
Systems Programmer | Just send me e-mail, maybe I'll write.
Electronic Vision / FITNE |
zztong@laxmi.ev.net | -- Joe Walsh for the 21st Century

#3Alex Carobus
acarobus@atl.lmco.com
In reply to: Bruce Tong (#2)
Re: [GENERAL] problem with floats

Sorry, I forgot to mention that the program works when all the float8's are
replaced by int4's.
Any other ideas?

-Alex

I was trying to use some c code to return floats to postgres but I keep
getting the following error :

template1=> select oner();
PQexec() -- Request was sent to backend, but backend closed the channel

before

Show quoted text

responding. This probably means the backend terminated abnormally before or
while processing the request.

From my (limited) experience, this message occurs when you fail to get a

connection to the database. I do not believe it has anything to do with
the floating point stuff you're trying, but probably more to do with your
call to PQsetdb(), environment variables, or entries in your pg_hba.conf
file.

I hope I'm not leading you in the wrong direction with this answer, but
that's what I'd be checking if I hadn't already.

Bruce Tong | Got me an office; I'm there late at night.
Systems Programmer | Just send me e-mail, maybe I'll write.
Electronic Vision / FITNE |
zztong@laxmi.ev.net | -- Joe Walsh for the 21st Century

#4Michal Maru¹ka
mmaruska@tin.it
In reply to: Alex Carobus (#3)
Re: [GENERAL] problem with floats

I was trying to use some c code to return floats to postgres but I keep
getting the following error :

template1=> select oner();
PQexec() -- Request was sent to backend, but backend closed the channel before
responding. This probably means the backend terminated abnormally before or
while processing the request.

From my (limited) experience, this message occurs when you fail to get a

read the manual (about libpg). Types longer than 4 bytes are referenced exclusively by pointer, you cannot
expect/return the value itself.

bye