SELECT sqlj.set_classpath('postgresforest', 'PartitionUtils');

--
-- one partition key
--
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, smallint)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.Integer)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, integer)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.Integer)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, text)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.String)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, date)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Date)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, time)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Time)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, timestamp)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Timestamp)'
        LANGUAGE javaU;

--
-- two partition keys
--
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, integer, integer)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Integer)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, integer, text)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.String)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, integer, date)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.Integer, java.sql.Date)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, integer, time)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.Integer, java.sql.Time)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, integer, timestamp)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.Integer, java.sql.Timestamp)'
        LANGUAGE javaU;

CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, text, integer)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.String, java.lang.Integer)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, text, text)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.String, java.lang.String)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, text, date)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.String, java.sql.Date)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, text, time)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.String, java.sql.Time)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, text, integer, timestamp)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.lang.String, java.sql.Timestamp)'
        LANGUAGE javaU;

CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, date, integer)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Date, java.lang.Integer)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, date, text)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Date, java.lang.String)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, date, date)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Date, java.sql.Date)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, date, time)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Date, java.sql.Time)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, date, integer, timestamp)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Date, java.sql.Timestamp)'
        LANGUAGE javaU;

CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, time, integer)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Time, java.lang.Integer)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, time, text)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Time, java.lang.String)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, time, date)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Time, java.sql.Date)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, time, time)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Time, java.sql.Time)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, time, integer, timestamp)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Time, java.sql.Timestamp)'
        LANGUAGE javaU;

CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, timestamp, integer)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Timestamp, java.lang.Integer)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, timestamp, text)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Timestamp, java.lang.String)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, timestamp, date)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Timestamp, java.sql.Date)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, timestamp, time)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Timestamp, java.sql.Time)'
        LANGUAGE javaU;
CREATE OR REPLACE FUNCTION postgresforest.getpartnum(text, integer, timestamp, integer, timestamp)
        RETURNS int
        AS 'org.postgresforest.tool.lib.PartitionUtils.getpartnum(java.lang.String, java.lang.Integer, java.sql.Timestamp, java.sql.Timestamp)'
        LANGUAGE javaU;
