Problem with Postgresql function
Posted: Wed Sep 30, 2009 10:13 pm
I have a simple function set up to query my postgesql db here's the function
when I run this function for a value pair that doesn't exist in the table, I would expect to get no rows returned, but instead I get 1 row with no value. Is there any way to stop this?
If I run the query itself it returns no rows as expected.
Code: Select all
CREATE OR REPLACE FUNCTION query_unit_owner_exists(bigint, bigint)
RETURNS bigint AS
'SELECT id FROM unit_owner WHERE unit = $1 and owner=$2'
LANGUAGE 'sql' VOLATILE
COST 100;
If I run the query itself it returns no rows as expected.