I am having a problem with the way the function is written. Could you pls chk on it :- ?

I want to write a function which gives me the result of this query :-

select * from customer where cast(customerid as char(8)) in ('156');

the function that i have written is as follows :-

create or replace function F_Customerdisplay(text)
returns record as '
declare a record;
select * into a from customer where cast(customerid as char(10)) = ''$1'';
return a;
end;' Language plpgsql;

the function is created :-


select * from f_customerdisplay('156') as (customerid int,resellerid int,username varchar,name varchar,company varchar,city varchar,country varchar,customerstatus varchar,websitecount integer,totalreceipts numeric);

when i run this query to get the results :-

i get the error :-
ERROR: ExecMakeTableFunctionResult: Invalid result from function returning tuple

I have gone across many net based help which say normally the function writtens this error if it returns a null value. but how is it possible :-

cause in my case the value is very well present.

Is there any way out of this mess , pls help :-

Thank you very much.