problem with calling c functions

Started by Richard Harvey Chapmanover 25 years ago3 messagesgeneral
Jump to latest
#1Richard Harvey Chapman
hchapman@3gfp.com

I'll just show an example:

I have:

int myfunc (text *a, text* b)
{
return(12);
}

in psql:

test=# CREATE FUNCTION myfunc(text, text)
test-# RETURNS integer
test-# AS
'/home/hchapman/src/nms/wwp_database/c-functions/call_dynamic.so'
test-# LANGUAGE 'C';
CREATE
test=# SELECT myfunc('aa','ss') as result;
result
--------
12
(1 row)

test=# SELECT myfunc('aa',NULL) as result;
result
--------

(1 row)

test=#

#2Richard Harvey Chapman
hchapman@3gfp.com
In reply to: Richard Harvey Chapman (#1)
Re: problem with calling c functions

oops, got a little trigger-happy with the send button.

Question: Why isn't 12 printed after the second SELECT statement?

Thanks,

R.

On Thu, 21 Sep 2000, Richard Harvey Chapman wrote:

Show quoted text

I'll just show an example:

I have:

int myfunc (text *a, text* b)
{
return(12);
}

in psql:

test=# CREATE FUNCTION myfunc(text, text)
test-# RETURNS integer
test-# AS
'/home/hchapman/src/nms/wwp_database/c-functions/call_dynamic.so'
test-# LANGUAGE 'C';
CREATE
test=# SELECT myfunc('aa','ss') as result;
result
--------
12
(1 row)

test=# SELECT myfunc('aa',NULL) as result;
result
--------

(1 row)

test=#

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Richard Harvey Chapman (#2)
Re: problem with calling c functions

Richard Harvey Chapman <hchapman@3gfp.com> writes:

Question: Why isn't 12 printed after the second SELECT statement?

NULL arguments/results for user functions are a longstanding problem
(check the list archives). This is finally fixed in current sources
for 7.1, but there's no good workaround in existing releases.

regards, tom lane