All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jooq.util.postgres.PostgresDataType Maven / Gradle / Ivy

There is a newer version: 3.19.11
Show newest version
/**
 * Copyright (c) 2009-2016, Data Geekery GmbH (http://www.datageekery.com)
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Other licenses:
 * -----------------------------------------------------------------------------
 * Commercial licenses for this work are available. These replace the above
 * ASL 2.0 and offer limited warranties, support, maintenance, and commercial
 * database integrations.
 *
 * For more information, please visit: http://www.jooq.org/licenses
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package org.jooq.util.postgres;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.UUID;

import org.jooq.DataType;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.SQLDialect;
import org.jooq.impl.DefaultDataType;
import org.jooq.impl.SQLDataType;
import org.jooq.types.DayToSecond;
import org.jooq.types.UByte;
import org.jooq.types.UInteger;
import org.jooq.types.ULong;
import org.jooq.types.UShort;
import org.jooq.types.YearToMonth;

/**
 * Supported data types for the {@link SQLDialect#POSTGRES} dialect
 *
 * @author Lukas Eder
 * @see http://www.postgresql.org/docs/9.0/interactive/datatype.html
 */
public class PostgresDataType {

    // -------------------------------------------------------------------------
    // Default SQL data types and synonyms thereof
    // -------------------------------------------------------------------------

    public static final DataType        SMALLINT                 = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.SMALLINT, "smallint");
    public static final DataType        INT2                     = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.SMALLINT, "int2");
    public static final DataType      INT                      = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.INTEGER, "int");
    public static final DataType      INTEGER                  = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.INTEGER, "integer");
    public static final DataType      INT4                     = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.INTEGER, "int4");
    public static final DataType         BIGINT                   = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.BIGINT, "bigint");
    public static final DataType         INT8                     = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.BIGINT, "int8");
    public static final DataType       DOUBLEPRECISION          = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.DOUBLE, "double precision");
    public static final DataType       FLOAT8                   = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.FLOAT, "float8");
    public static final DataType        REAL                     = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.REAL, "real");
    public static final DataType        FLOAT4                   = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.REAL, "float4");
    public static final DataType      BOOLEAN                  = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.BOOLEAN, "boolean");
    public static final DataType      BOOL                     = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.BOOLEAN, "bool");
    public static final DataType   NUMERIC                  = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.NUMERIC, "numeric");
    public static final DataType   DECIMAL                  = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.DECIMAL, "decimal");
    public static final DataType       VARCHAR                  = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.VARCHAR, "varchar");
    public static final DataType       CHARACTERVARYING         = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.VARCHAR, "character varying");
    public static final DataType       CHAR                     = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.CHAR, "char");
    public static final DataType       CHARACTER                = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.CHAR, "character");
    public static final DataType       TEXT                     = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.CLOB, "text");
    public static final DataType         DATE                     = new DefaultDataType(SQLDialect.POSTGRES, SQLDataType.DATE, "date");
    public static final DataType