/*
 * This file is generated by jOOQ.
 */
package ervu_secret.ervu_secret.db_beans.pg_catalog.tables;


import ervu_secret.ervu_secret.db_beans.pg_catalog.PgCatalog;
import ervu_secret.ervu_secret.db_beans.pg_catalog.tables.records.PgSeclabelsRecord;

import java.util.Collection;

import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.Name;
import org.jooq.PlainSQL;
import org.jooq.QueryPart;
import org.jooq.SQL;
import org.jooq.Schema;
import org.jooq.Select;
import org.jooq.Stringly;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;


/**
 * This class is generated by jOOQ.
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class PgSeclabels extends TableImpl<PgSeclabelsRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>pg_catalog.pg_seclabels</code>
     */
    public static final PgSeclabels PG_SECLABELS = new PgSeclabels();

    /**
     * The class holding records for this type
     */
    @Override
    public Class<PgSeclabelsRecord> getRecordType() {
        return PgSeclabelsRecord.class;
    }

    /**
     * The column <code>pg_catalog.pg_seclabels.objoid</code>.
     */
    public final TableField<PgSeclabelsRecord, Long> OBJOID = createField(DSL.name("objoid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_seclabels.classoid</code>.
     */
    public final TableField<PgSeclabelsRecord, Long> CLASSOID = createField(DSL.name("classoid"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_seclabels.objsubid</code>.
     */
    public final TableField<PgSeclabelsRecord, Integer> OBJSUBID = createField(DSL.name("objsubid"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>pg_catalog.pg_seclabels.objtype</code>.
     */
    public final TableField<PgSeclabelsRecord, String> OBJTYPE = createField(DSL.name("objtype"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_seclabels.objnamespace</code>.
     */
    public final TableField<PgSeclabelsRecord, Long> OBJNAMESPACE = createField(DSL.name("objnamespace"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>pg_catalog.pg_seclabels.objname</code>.
     */
    public final TableField<PgSeclabelsRecord, String> OBJNAME = createField(DSL.name("objname"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_seclabels.provider</code>.
     */
    public final TableField<PgSeclabelsRecord, String> PROVIDER = createField(DSL.name("provider"), SQLDataType.CLOB, this, "");

    /**
     * The column <code>pg_catalog.pg_seclabels.label</code>.
     */
    public final TableField<PgSeclabelsRecord, String> LABEL = createField(DSL.name("label"), SQLDataType.CLOB, this, "");

    private PgSeclabels(Name alias, Table<PgSeclabelsRecord> aliased) {
        this(alias, aliased, (Field<?>[]) null, null);
    }

    private PgSeclabels(Name alias, Table<PgSeclabelsRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
         create view "pg_seclabels" as  SELECT l.objoid,
            l.classoid,
            l.objsubid,
                CASE
                    WHEN (rel.relkind = ANY (ARRAY['r'::"char", 'p'::"char"])) THEN 'table'::text
                    WHEN (rel.relkind = 'v'::"char") THEN 'view'::text
                    WHEN (rel.relkind = 'm'::"char") THEN 'materialized view'::text
                    WHEN (rel.relkind = 'S'::"char") THEN 'sequence'::text
                    WHEN (rel.relkind = 'f'::"char") THEN 'foreign table'::text
                    ELSE NULL::text
                END AS objtype,
            rel.relnamespace AS objnamespace,
                CASE
                    WHEN pg_table_is_visible(rel.oid) THEN quote_ident((rel.relname)::text)
                    ELSE ((quote_ident((nsp.nspname)::text) || '.'::text) || quote_ident((rel.relname)::text))
                END AS objname,
            l.provider,
            l.label
           FROM ((pg_seclabel l
             JOIN pg_class rel ON (((l.classoid = rel.tableoid) AND (l.objoid = rel.oid))))
             JOIN pg_namespace nsp ON ((rel.relnamespace = nsp.oid)))
          WHERE (l.objsubid = 0)
        UNION ALL
         SELECT l.objoid,
            l.classoid,
            l.objsubid,
            'column'::text AS objtype,
            rel.relnamespace AS objnamespace,
            ((
                CASE
                    WHEN pg_table_is_visible(rel.oid) THEN quote_ident((rel.relname)::text)
                    ELSE ((quote_ident((nsp.nspname)::text) || '.'::text) || quote_ident((rel.relname)::text))
                END || '.'::text) || (att.attname)::text) AS objname,
            l.provider,
            l.label
           FROM (((pg_seclabel l
             JOIN pg_class rel ON (((l.classoid = rel.tableoid) AND (l.objoid = rel.oid))))
             JOIN pg_attribute att ON (((rel.oid = att.attrelid) AND (l.objsubid = att.attnum))))
             JOIN pg_namespace nsp ON ((rel.relnamespace = nsp.oid)))
          WHERE (l.objsubid <> 0)
        UNION ALL
         SELECT l.objoid,
            l.classoid,
            l.objsubid,
                CASE pro.prokind
                    WHEN 'a'::"char" THEN 'aggregate'::text
                    WHEN 'f'::"char" THEN 'function'::text
                    WHEN 'p'::"char" THEN 'procedure'::text
                    WHEN 'w'::"char" THEN 'window'::text
                    ELSE NULL::text
                END AS objtype,
            pro.pronamespace AS objnamespace,
            (((
                CASE
                    WHEN pg_function_is_visible(pro.oid) THEN quote_ident((pro.proname)::text)
                    ELSE ((quote_ident((nsp.nspname)::text) || '.'::text) || quote_ident((pro.proname)::text))
                END || '('::text) || pg_get_function_arguments(pro.oid)) || ')'::text) AS objname,
            l.provider,
            l.label
           FROM ((pg_seclabel l
             JOIN pg_proc pro ON (((l.classoid = pro.tableoid) AND (l.objoid = pro.oid))))
             JOIN pg_namespace nsp ON ((pro.pronamespace = nsp.oid)))
          WHERE (l.objsubid = 0)
        UNION ALL
         SELECT l.objoid,
            l.classoid,
            l.objsubid,
                CASE
                    WHEN (typ.typtype = 'd'::"char") THEN 'domain'::text
                    ELSE 'type'::text
                END AS objtype,
            typ.typnamespace AS objnamespace,
                CASE
                    WHEN pg_type_is_visible(typ.oid) THEN quote_ident((typ.typname)::text)
                    ELSE ((quote_ident((nsp.nspname)::text) || '.'::text) || quote_ident((typ.typname)::text))
                END AS objname,
            l.provider,
            l.label
           FROM ((pg_seclabel l
             JOIN pg_type typ ON (((l.classoid = typ.tableoid) AND (l.objoid = typ.oid))))
             JOIN pg_namespace nsp ON ((typ.typnamespace = nsp.oid)))
          WHERE (l.objsubid = 0)
        UNION ALL
         SELECT l.objoid,
            l.classoid,
            l.objsubid,
            'large object'::text AS objtype,
            NULL::oid AS objnamespace,
            (l.objoid)::text AS objname,
            l.provider,
            l.label
           FROM (pg_seclabel l
             JOIN pg_largeobject_metadata lom ON ((l.objoid = lom.oid)))
          WHERE ((l.classoid = ('pg_largeobject'::regclass)::oid) AND (l.objsubid = 0))
        UNION ALL
         SELECT l.objoid,
            l.classoid,
            l.objsubid,
            'language'::text AS objtype,
            NULL::oid AS objnamespace,
            quote_ident((lan.lanname)::text) AS objname,
            l.provider,
            l.label
           FROM (pg_seclabel l
             JOIN pg_language lan ON (((l.classoid = lan.tableoid) AND (l.objoid = lan.oid))))
          WHERE (l.objsubid = 0)
        UNION ALL
         SELECT l.objoid,
            l.classoid,
            l.objsubid,
            'schema'::text AS objtype,
            nsp.oid AS objnamespace,
            quote_ident((nsp.nspname)::text) AS objname,
            l.provider,
            l.label
           FROM (pg_seclabel l
             JOIN pg_namespace nsp ON (((l.classoid = nsp.tableoid) AND (l.objoid = nsp.oid))))
          WHERE (l.objsubid = 0)
        UNION ALL
         SELECT l.objoid,
            l.classoid,
            l.objsubid,
            'event trigger'::text AS objtype,
            NULL::oid AS objnamespace,
            quote_ident((evt.evtname)::text) AS objname,
            l.provider,
            l.label
           FROM (pg_seclabel l
             JOIN pg_event_trigger evt ON (((l.classoid = evt.tableoid) AND (l.objoid = evt.oid))))
          WHERE (l.objsubid = 0)
        UNION ALL
         SELECT l.objoid,
            l.classoid,
            l.objsubid,
            'publication'::text AS objtype,
            NULL::oid AS objnamespace,
            quote_ident((p.pubname)::text) AS objname,
            l.provider,
            l.label
           FROM (pg_seclabel l
             JOIN pg_publication p ON (((l.classoid = p.tableoid) AND (l.objoid = p.oid))))
          WHERE (l.objsubid = 0)
        UNION ALL
         SELECT l.objoid,
            l.classoid,
            0 AS objsubid,
            'subscription'::text AS objtype,
            NULL::oid AS objnamespace,
            quote_ident((s.subname)::text) AS objname,
            l.provider,
            l.label
           FROM (pg_shseclabel l
             JOIN pg_subscription s ON (((l.classoid = s.tableoid) AND (l.objoid = s.oid))))
        UNION ALL
         SELECT l.objoid,
            l.classoid,
            0 AS objsubid,
            'database'::text AS objtype,
            NULL::oid AS objnamespace,
            quote_ident((dat.datname)::text) AS objname,
            l.provider,
            l.label
           FROM (pg_shseclabel l
             JOIN pg_database dat ON (((l.classoid = dat.tableoid) AND (l.objoid = dat.oid))))
        UNION ALL
         SELECT l.objoid,
            l.classoid,
            0 AS objsubid,
            'tablespace'::text AS objtype,
            NULL::oid AS objnamespace,
            quote_ident((spc.spcname)::text) AS objname,
            l.provider,
            l.label
           FROM (pg_shseclabel l
             JOIN pg_tablespace spc ON (((l.classoid = spc.tableoid) AND (l.objoid = spc.oid))))
        UNION ALL
         SELECT l.objoid,
            l.classoid,
            0 AS objsubid,
            'role'::text AS objtype,
            NULL::oid AS objnamespace,
            quote_ident((rol.rolname)::text) AS objname,
            l.provider,
            l.label
           FROM (pg_shseclabel l
             JOIN pg_authid rol ON (((l.classoid = rol.tableoid) AND (l.objoid = rol.oid))));
        """), where);
    }

    /**
     * Create an aliased <code>pg_catalog.pg_seclabels</code> table reference
     */
    public PgSeclabels(String alias) {
        this(DSL.name(alias), PG_SECLABELS);
    }

    /**
     * Create an aliased <code>pg_catalog.pg_seclabels</code> table reference
     */
    public PgSeclabels(Name alias) {
        this(alias, PG_SECLABELS);
    }

    /**
     * Create a <code>pg_catalog.pg_seclabels</code> table reference
     */
    public PgSeclabels() {
        this(DSL.name("pg_seclabels"), null);
    }

    @Override
    public Schema getSchema() {
        return aliased() ? null : PgCatalog.PG_CATALOG;
    }

    @Override
    public PgSeclabels as(String alias) {
        return new PgSeclabels(DSL.name(alias), this);
    }

    @Override
    public PgSeclabels as(Name alias) {
        return new PgSeclabels(alias, this);
    }

    @Override
    public PgSeclabels as(Table<?> alias) {
        return new PgSeclabels(alias.getQualifiedName(), this);
    }

    /**
     * Rename this table
     */
    @Override
    public PgSeclabels rename(String name) {
        return new PgSeclabels(DSL.name(name), null);
    }

    /**
     * Rename this table
     */
    @Override
    public PgSeclabels rename(Name name) {
        return new PgSeclabels(name, null);
    }

    /**
     * Rename this table
     */
    @Override
    public PgSeclabels rename(Table<?> name) {
        return new PgSeclabels(name.getQualifiedName(), null);
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgSeclabels where(Condition condition) {
        return new PgSeclabels(getQualifiedName(), aliased() ? this : null, null, condition);
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgSeclabels where(Collection<? extends Condition> conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgSeclabels where(Condition... conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgSeclabels where(Field<Boolean> condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public PgSeclabels where(SQL condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public PgSeclabels where(@Stringly.SQL String condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public PgSeclabels where(@Stringly.SQL String condition, Object... binds) {
        return where(DSL.condition(condition, binds));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public PgSeclabels where(@Stringly.SQL String condition, QueryPart... parts) {
        return where(DSL.condition(condition, parts));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgSeclabels whereExists(Select<?> select) {
        return where(DSL.exists(select));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public PgSeclabels whereNotExists(Select<?> select) {
        return where(DSL.notExists(select));
    }
}
