CREATE FUNCTION ad_to_bs(adDate date) RETURNS bs_date
AS 'MODULE_PATHNAME', 'ad_to_bs'
LANGUAGE C IMMUTABLE STRICT;

-- overloading the standard to_char function
-- in order to allow usage like: SELECT to_char(bs_date_value, 'YYYY/MM/DD')
CREATE FUNCTION to_char(bs_date, text) RETURNS text
AS 'MODULE_PATHNAME', 'bs_date_to_char'
LANGUAGE C IMMUTABLE STRICT;

-- overloading the standard to_char function
-- in order to allow usage like: SELECT to_char(bs_date_value, 'YYYY/MM/DD', 'dev')
CREATE FUNCTION to_char(bs_date, text, text) RETURNS text
AS 'MODULE_PATHNAME', 'bs_date_to_char_lang'
LANGUAGE C IMMUTABLE STRICT;

CREATE FUNCTION current_bs_date() returns bs_date
AS 'MODULE_PATHNAME', 'current_bs_date'
LANGUAGE C STABLE;

