c function return not recognized? - Mailing list pgsql-general

From Frank Miles
Subject c function return not recognized?
Date
Msg-id Pine.OSF.4.10.9912112108340.20779-100000@saul7.u.washington.edu
Whole thread Raw
Responses Re: [GENERAL] c function return not recognized?  ("Gene Selkov Jr." <selkovjr@selkovjr.xnet.com>)
Large objects + JDBC  (Marcin Mazurek - Multinet SA - Poznan <m.mazurek@multinet.pl>)
List 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




pgsql-general by date:

Previous
From: David Sauer
Date:
Subject: Re: [GENERAL] Czech Win1250 sorting q
Next
From: "Gene Selkov Jr."
Date:
Subject: Re: [GENERAL] c function return not recognized?