forked from SimplesIP/pabx-app
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
398 B
15 lines
398 B
--DROP FUNCTION strtoint(character varying, integer); |
|
CREATE OR REPLACE FUNCTION strtoint( |
|
txt character varying, |
|
def integer DEFAULT 0) |
|
RETURNS bigint AS |
|
$BODY$ |
|
BEGIN |
|
|
|
return case when((coalesce(txt, '') ~ E'^(\\-|\\+)?\\d+$')) then txt::bigint else def end; |
|
END; |
|
$BODY$ |
|
LANGUAGE plpgsql VOLATILE |
|
COST 100; |
|
ALTER FUNCTION strtoint(character varying, integer) |
|
OWNER TO contacte; |