PostgreSQL 9.5.4
I have the below function where I am attempting to use the parameters within the Regex. Something like
CREATE OR REPLACE FUNCTION test(lastname text, firstname text, birthdate date)
RETURNS SETOF view_patient AS
$BODY$
select * from testing t
where t.lastname ~* '^' || $1 || ''
order by t.lastname
$BODY$
LANGUAGE sql VOLATILE;
The returned error is:
ERROR: argument of WHERE must be type boolean, not type text LINE 55: where t.lastname ~* '^' || $1 || ''
How is this done?
TIA