c function return not recognized?

From: Frank Miles <fpm(at)u(dot)washington(dot)edu>
To: pgsql-general(at)postgreSQL(dot)org
Subject: c function return not recognized?
Date: 1999-12-12 05:19:28
Message-ID: Pine.OSF.4.10.9912112108340.20779-100000@saul7.u.washington.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've got an external C function that I call from a SELECT, for example:

select * from <table> where <cond1> and CFunction(columnName) > 1.0;

The 'CFunction' has been installed into Postgreql using CREATE FUNCTION,
with a single 'text' argument, and returning a float8 (i.e. double).
I can tell that the 'CFunction' is getting called with the correct
argument, because it can be compiled to echo its activities to a file.
Also, if I rewrite the second condition (for example, leaving out the
'>' sign), psql complains that the function returns a float8, not a
boolean value.

The problem is that Postgresql seems to treat the latter condition
as an "fail always". I can compile the function to return a constant,
say for example, 1.0. Without the second condition, I always get the
expected set of results. With the second condition, no results are
returned regardless of the sense of the comparison: >, <, =, <> all
return nothing.

I would appreciate it if someone could help me be able to use an
externally compiled function that returns a result.

TIA!

-frank

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert 1999-12-12 07:30:42 Re: [GENERAL] Czech Win1250 sorting q
Previous Message David Sauer 1999-12-12 01:30:31 Re: [GENERAL] Czech Win1250 sorting q