Note to self...

Thu Aug 28
CREATE OR REPLACE FUNCTION pc_chartoint(chartoconvert character varying) RETURNS integer AS $BODY$ SELECT CASE WHEN trim($1) SIMILAR TO ‘[0-9]+’ THEN CAST(trim($1) AS integer) ELSE NULL END; $BODY$ LANGUAGE ‘sql’ IMMUTABLE STRICT; How to convert a table column to another data type - Postgres OnLine Journal