core-jgi/migration/330-331b/postgresql/044_BF_1824260.sql

32 lines
697 B
MySQL
Raw Normal View History

2007-12-06 10:29:07 +07:00
CREATE OR REPLACE FUNCTION "adempiere"."subtractdays" (in inter interval, in days numeric) RETURNS integer AS
$BODY$
BEGIN
RETURN ( EXTRACT( EPOCH FROM ( inter ) ) / 86400 ) - days;
END;
$BODY$
LANGUAGE 'plpgsql';
CREATE OPERATOR - (
PROCEDURE = subtractdays,
LEFTARG = interval,
RIGHTARG = numeric,
COMMUTATOR = -
);
CREATE OR REPLACE FUNCTION "adempiere"."adddays" (in inter interval, in days numeric) RETURNS integer AS
$BODY$
BEGIN
RETURN ( EXTRACT( EPOCH FROM ( inter ) ) / 86400 ) + days;
END;
$BODY$
LANGUAGE 'plpgsql';
CREATE OPERATOR + (
PROCEDURE = adddays,
LEFTARG = interval,
RIGHTARG = numeric,
COMMUTATOR = -
);
ALTER OPERATOR adempiere.+ (interval, numeric) OWNER TO adempiere;