[jOOQ/jOOQ#11876] Regression in OracleDatabase for sequences with large MAXVALUE
This commit is contained in:
parent
05551ece2a
commit
192b5dcbaf
@ -37,6 +37,8 @@
|
||||
*/
|
||||
package org.jooq.meta;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
import org.jooq.Internal;
|
||||
@ -111,5 +113,5 @@ public interface ResultQueryDatabase extends Database {
|
||||
* </ol>
|
||||
*/
|
||||
@Internal
|
||||
ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, Long, Long, Boolean, Long>> sequences(List<String> schemas);
|
||||
ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, BigDecimal, BigDecimal, Boolean, Long>> sequences(List<String> schemas);
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@ import static org.jooq.impl.DSL.when;
|
||||
import static org.jooq.impl.SQLDataType.BIGINT;
|
||||
import static org.jooq.impl.SQLDataType.BOOLEAN;
|
||||
import static org.jooq.impl.SQLDataType.INTEGER;
|
||||
import static org.jooq.impl.SQLDataType.NUMERIC;
|
||||
import static org.jooq.impl.SQLDataType.VARCHAR;
|
||||
import static org.jooq.meta.derby.sys.Tables.SYSCHECKS;
|
||||
import static org.jooq.meta.derby.sys.Tables.SYSCONGLOMERATES;
|
||||
@ -63,6 +64,7 @@ import static org.jooq.meta.derby.sys.Tables.SYSSEQUENCES;
|
||||
import static org.jooq.meta.derby.sys.Tables.SYSTABLES;
|
||||
import static org.jooq.meta.derby.sys.Tables.SYSVIEWS;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -350,7 +352,7 @@ public class DerbyDatabase extends AbstractDatabase implements ResultQueryDataba
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, Long, Long, Boolean, Long>> sequences(List<String> schemas) {
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, BigDecimal, BigDecimal, Boolean, Long>> sequences(List<String> schemas) {
|
||||
return create().select(
|
||||
inline(null, VARCHAR).cast(VARCHAR).as("catalog"),
|
||||
SYSSEQUENCES.sysschemas().SCHEMANAME,
|
||||
@ -364,12 +366,12 @@ public class DerbyDatabase extends AbstractDatabase implements ResultQueryDataba
|
||||
.when(inline("SMALLINT"), inline((long) Short.MIN_VALUE))
|
||||
.when(inline("INTEGER"), inline((long) Integer.MIN_VALUE))
|
||||
.when(inline("BIGINT"), inline(Long.MIN_VALUE))
|
||||
).as(SYSSEQUENCES.MINIMUMVALUE),
|
||||
).coerce(NUMERIC).as(SYSSEQUENCES.MINIMUMVALUE),
|
||||
nullif(SYSSEQUENCES.MAXIMUMVALUE, case_(cast(SYSSEQUENCES.SEQUENCEDATATYPE, VARCHAR))
|
||||
.when(inline("SMALLINT"), inline((long) Short.MAX_VALUE))
|
||||
.when(inline("INTEGER"), inline((long) Integer.MAX_VALUE))
|
||||
.when(inline("BIGINT"), inline(Long.MAX_VALUE))
|
||||
).as(SYSSEQUENCES.MAXIMUMVALUE),
|
||||
).coerce(NUMERIC).as(SYSSEQUENCES.MAXIMUMVALUE),
|
||||
field(SYSSEQUENCES.CYCLEOPTION.eq(inline("Y"))).as(SYSSEQUENCES.CYCLEOPTION),
|
||||
inline(null, BIGINT).cast(BIGINT).as("cache")
|
||||
)
|
||||
|
||||
@ -55,6 +55,7 @@ import static org.jooq.impl.DSL.when;
|
||||
import static org.jooq.impl.SQLDataType.BIGINT;
|
||||
import static org.jooq.impl.SQLDataType.BOOLEAN;
|
||||
import static org.jooq.impl.SQLDataType.INTEGER;
|
||||
import static org.jooq.impl.SQLDataType.NUMERIC;
|
||||
import static org.jooq.impl.SQLDataType.SMALLINT;
|
||||
import static org.jooq.impl.SQLDataType.VARCHAR;
|
||||
import static org.jooq.meta.firebird.rdb.Tables.RDB$CHECK_CONSTRAINTS;
|
||||
@ -73,6 +74,7 @@ import static org.jooq.meta.firebird.rdb.Tables.RDB$RELATION_CONSTRAINTS;
|
||||
import static org.jooq.meta.firebird.rdb.Tables.RDB$RELATION_FIELDS;
|
||||
import static org.jooq.meta.firebird.rdb.Tables.RDB$TRIGGERS;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -383,7 +385,7 @@ public class FirebirdDatabase extends AbstractDatabase implements ResultQueryDat
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, Long, Long, Boolean, Long>> sequences(List<String> schemas) {
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, BigDecimal, BigDecimal, Boolean, Long>> sequences(List<String> schemas) {
|
||||
return create()
|
||||
.select(
|
||||
inline(null, VARCHAR).as("catalog"),
|
||||
@ -399,8 +401,8 @@ public class FirebirdDatabase extends AbstractDatabase implements ResultQueryDat
|
||||
(is30()
|
||||
? nullif(RDB$GENERATORS.RDB$GENERATOR_INCREMENT, inline(1))
|
||||
: inline(1)).coerce(BIGINT).as(RDB$GENERATORS.RDB$GENERATOR_INCREMENT),
|
||||
inline(null, BIGINT).as("min_value"),
|
||||
inline(null, BIGINT).as("max_value"),
|
||||
inline(null, NUMERIC).as("min_value"),
|
||||
inline(null, NUMERIC).as("max_value"),
|
||||
inline(null, BOOLEAN).as("cycle"),
|
||||
inline(null, BIGINT).as("cache")
|
||||
)
|
||||
|
||||
@ -52,6 +52,7 @@ import static org.jooq.impl.DSL.upper;
|
||||
import static org.jooq.impl.DSL.when;
|
||||
import static org.jooq.impl.SQLDataType.BIGINT;
|
||||
import static org.jooq.impl.SQLDataType.INTEGER;
|
||||
import static org.jooq.impl.SQLDataType.NUMERIC;
|
||||
import static org.jooq.impl.SQLDataType.VARCHAR;
|
||||
import static org.jooq.meta.h2.information_schema.Tables.COLUMNS;
|
||||
import static org.jooq.meta.h2.information_schema.Tables.CONSTRAINTS;
|
||||
@ -66,6 +67,7 @@ import static org.jooq.meta.h2.information_schema.Tables.TYPE_INFO;
|
||||
import static org.jooq.meta.h2.information_schema.Tables.VIEWS;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -88,6 +90,7 @@ import org.jooq.Table;
|
||||
import org.jooq.TableField;
|
||||
import org.jooq.TableOptions.TableType;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.impl.SQLDataType;
|
||||
import org.jooq.meta.AbstractDatabase;
|
||||
import org.jooq.meta.AbstractIndexDefinition;
|
||||
import org.jooq.meta.ArrayDefinition;
|
||||
@ -402,7 +405,7 @@ public class H2Database extends AbstractDatabase implements ResultQueryDatabase
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, Long, Long, Boolean, Long>> sequences(List<String> schemas) {
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, BigDecimal, BigDecimal, Boolean, Long>> sequences(List<String> schemas) {
|
||||
return create()
|
||||
.select(
|
||||
inline(null, VARCHAR).as("catalog"),
|
||||
@ -413,8 +416,8 @@ public class H2Database extends AbstractDatabase implements ResultQueryDatabase
|
||||
inline(null, INTEGER).as("scale"),
|
||||
inline(null, BIGINT).as("start_value"),
|
||||
nullif(SEQUENCES.INCREMENT, inline(1L)).as(SEQUENCES.INCREMENT),
|
||||
nullif(SEQUENCES.MIN_VALUE, inline(1L)).as(SEQUENCES.MIN_VALUE),
|
||||
nullif(SEQUENCES.MAX_VALUE, inline(DEFAULT_SEQUENCE_MAXVALUE)).as(SEQUENCES.MAX_VALUE),
|
||||
nullif(SEQUENCES.MIN_VALUE, inline(1L)).coerce(NUMERIC).as(SEQUENCES.MIN_VALUE),
|
||||
nullif(SEQUENCES.MAX_VALUE, inline(DEFAULT_SEQUENCE_MAXVALUE)).coerce(NUMERIC).as(SEQUENCES.MAX_VALUE),
|
||||
SEQUENCES.IS_CYCLE,
|
||||
nullif(SEQUENCES.CACHE, inline(DEFAULT_SEQUENCE_CACHE)).as(SEQUENCES.CACHE)
|
||||
)
|
||||
|
||||
@ -38,8 +38,6 @@
|
||||
|
||||
package org.jooq.meta.hsqldb;
|
||||
|
||||
import static java.util.stream.Collectors.mapping;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.jooq.Records.mapping;
|
||||
import static org.jooq.impl.DSL.decode;
|
||||
import static org.jooq.impl.DSL.falseCondition;
|
||||
@ -52,6 +50,7 @@ import static org.jooq.impl.DSL.select;
|
||||
import static org.jooq.impl.DSL.when;
|
||||
import static org.jooq.impl.SQLDataType.BIGINT;
|
||||
import static org.jooq.impl.SQLDataType.INTEGER;
|
||||
import static org.jooq.impl.SQLDataType.NUMERIC;
|
||||
import static org.jooq.impl.SQLDataType.VARCHAR;
|
||||
import static org.jooq.meta.hsqldb.information_schema.Tables.CHECK_CONSTRAINTS;
|
||||
import static org.jooq.meta.hsqldb.information_schema.Tables.COLUMNS;
|
||||
@ -67,25 +66,25 @@ import static org.jooq.meta.hsqldb.information_schema.Tables.SYSTEM_TABLES;
|
||||
import static org.jooq.meta.hsqldb.information_schema.Tables.TABLE_CONSTRAINTS;
|
||||
import static org.jooq.meta.hsqldb.information_schema.Tables.VIEWS;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Record12;
|
||||
import org.jooq.Record6;
|
||||
import org.jooq.Records;
|
||||
import org.jooq.Result;
|
||||
import org.jooq.ResultQuery;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.SortOrder;
|
||||
import org.jooq.TableOptions.TableType;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.impl.SQLDataType;
|
||||
import org.jooq.meta.AbstractDatabase;
|
||||
import org.jooq.meta.AbstractIndexDefinition;
|
||||
import org.jooq.meta.ArrayDefinition;
|
||||
@ -391,7 +390,7 @@ public class HSQLDBDatabase extends AbstractDatabase implements ResultQueryDatab
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, Long, Long, Boolean, Long>> sequences(List<String> schemas) {
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, BigDecimal, BigDecimal, Boolean, Long>> sequences(List<String> schemas) {
|
||||
return create()
|
||||
.select(
|
||||
inline(null, VARCHAR).as("catalog"),
|
||||
@ -402,8 +401,8 @@ public class HSQLDBDatabase extends AbstractDatabase implements ResultQueryDatab
|
||||
SEQUENCES.NUMERIC_SCALE.coerce(INTEGER),
|
||||
SEQUENCES.START_WITH.coerce(BIGINT),
|
||||
SEQUENCES.INCREMENT.coerce(BIGINT),
|
||||
SEQUENCES.MINIMUM_VALUE.coerce(BIGINT),
|
||||
SEQUENCES.MAXIMUM_VALUE.coerce(BIGINT),
|
||||
SEQUENCES.MINIMUM_VALUE.coerce(NUMERIC),
|
||||
SEQUENCES.MAXIMUM_VALUE.coerce(NUMERIC),
|
||||
decode(SEQUENCES.CYCLE_OPTION, inline("YES"), inline(true), inline(false)).as(SEQUENCES.CYCLE_OPTION),
|
||||
inline(null, BIGINT).as("cache"))
|
||||
.from(SEQUENCES)
|
||||
|
||||
@ -46,6 +46,7 @@ import static org.jooq.impl.SQLDataType.BIGINT;
|
||||
import static org.jooq.impl.SQLDataType.BOOLEAN;
|
||||
import static org.jooq.meta.mysql.information_schema.Tables.TABLES;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -77,7 +78,7 @@ public class MariaDBDatabase extends MySQLDatabase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, Long, Long, Boolean, Long>> sequences(List<String> schemas) {
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, BigDecimal, BigDecimal, Boolean, Long>> sequences(List<String> schemas) {
|
||||
|
||||
// [#10844] [#10854] TODO We need a way to create a dynamic FROM clause in order to group the below sequences in a single one
|
||||
return null;
|
||||
|
||||
@ -63,6 +63,7 @@ import static org.jooq.meta.mysql.information_schema.Tables.VIEWS;
|
||||
import static org.jooq.meta.mysql.mysql.Tables.PROC;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -408,7 +409,7 @@ public class MySQLDatabase extends AbstractDatabase implements ResultQueryDataba
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, Long, Long, Boolean, Long>> sequences(List<String> schemas) {
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, BigDecimal, BigDecimal, Boolean, Long>> sequences(List<String> schemas) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -77,6 +77,7 @@ import static org.jooq.impl.SQLDataType.BIGINT;
|
||||
import static org.jooq.impl.SQLDataType.BOOLEAN;
|
||||
import static org.jooq.impl.SQLDataType.DECIMAL_INTEGER;
|
||||
import static org.jooq.impl.SQLDataType.INTEGER;
|
||||
import static org.jooq.impl.SQLDataType.NUMERIC;
|
||||
import static org.jooq.impl.SQLDataType.VARCHAR;
|
||||
import static org.jooq.meta.postgres.information_schema.Tables.ATTRIBUTES;
|
||||
import static org.jooq.meta.postgres.information_schema.Tables.CHECK_CONSTRAINTS;
|
||||
@ -103,6 +104,7 @@ import static org.jooq.util.postgres.PostgresDSL.array;
|
||||
import static org.jooq.util.postgres.PostgresDSL.arrayAppend;
|
||||
import static org.jooq.util.postgres.PostgresDSL.oid;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
@ -645,7 +647,7 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, Long, Long, Boolean, Long>> sequences(List<String> schemas) {
|
||||
public ResultQuery<Record12<String, String, String, String, Integer, Integer, Long, Long, BigDecimal, BigDecimal, Boolean, Long>> sequences(List<String> schemas) {
|
||||
CommonTableExpression<Record1<String>> s = name("schemas").fields("schema").as(selectFrom(values(schemas.stream().collect(toRowArray(DSL::val)))));
|
||||
|
||||
return create()
|
||||
@ -659,9 +661,9 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
|
||||
SEQUENCES.NUMERIC_SCALE,
|
||||
nullif(SEQUENCES.START_VALUE.cast(BIGINT), inline(1L)).as(SEQUENCES.START_VALUE),
|
||||
nullif(SEQUENCES.INCREMENT.cast(BIGINT), inline(1L)).as(SEQUENCES.INCREMENT),
|
||||
nullif(SEQUENCES.MINIMUM_VALUE.cast(BIGINT), inline(1L)).as(SEQUENCES.MINIMUM_VALUE),
|
||||
nullif(SEQUENCES.MINIMUM_VALUE.cast(BIGINT), inline(1L)).coerce(NUMERIC).as(SEQUENCES.MINIMUM_VALUE),
|
||||
nullif(SEQUENCES.MAXIMUM_VALUE.cast(DECIMAL_INTEGER),
|
||||
power(cast(inline(2L), DECIMAL_INTEGER), cast(SEQUENCES.NUMERIC_PRECISION.minus(inline(1L)), DECIMAL_INTEGER)).minus(inline(1L))).coerce(BIGINT).as(SEQUENCES.MAXIMUM_VALUE),
|
||||
power(cast(inline(2L), DECIMAL_INTEGER), cast(SEQUENCES.NUMERIC_PRECISION.minus(inline(1L)), DECIMAL_INTEGER)).minus(inline(1L))).coerce(NUMERIC).as(SEQUENCES.MAXIMUM_VALUE),
|
||||
SEQUENCES.CYCLE_OPTION.cast(BOOLEAN).as(SEQUENCES.CYCLE_OPTION),
|
||||
inline(null, BIGINT).as("cache"))
|
||||
.from(SEQUENCES)
|
||||
@ -689,9 +691,9 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
|
||||
field("information_schema._pg_numeric_precision({0}, {1})", INTEGER, PG_SEQUENCE.pgType().TYPBASETYPE, PG_SEQUENCE.pgType().TYPTYPMOD),
|
||||
inline(0),
|
||||
PG_SEQUENCE.SEQSTART,
|
||||
PG_SEQUENCE.SEQMIN,
|
||||
PG_SEQUENCE.SEQMAX,
|
||||
PG_SEQUENCE.SEQINCREMENT,
|
||||
PG_SEQUENCE.SEQMIN.coerce(NUMERIC),
|
||||
PG_SEQUENCE.SEQMAX.coerce(NUMERIC),
|
||||
PG_SEQUENCE.SEQCYCLE,
|
||||
inline(null, BIGINT).as("cache"))
|
||||
.from(PG_SEQUENCE)
|
||||
@ -703,7 +705,7 @@ public class PostgresDatabase extends AbstractDatabase implements ResultQueryDat
|
||||
.and(PG_DEPEND.CLASSID.eq(field("'pg_class'::regclass", PG_DEPEND.CLASSID.getDataType())))
|
||||
))
|
||||
// AND NOT EXISTS (SELECT 1 FROM pg_depend WHERE classid = 'pg_class'::regclass AND objid = c.oid AND deptype = 'i')
|
||||
: select(inline(""), inline(""), inline(""), inline(""), inline(0), inline(0), inline(0L), inline(0L), inline(0L), inline(0L), inline(false), inline(0L))
|
||||
: select(inline(""), inline(""), inline(""), inline(""), inline(0), inline(0), inline(0L), inline(0L), inline(BigDecimal.ZERO), inline(BigDecimal.ZERO), inline(false), inline(0L))
|
||||
.where(falseCondition()))
|
||||
.orderBy(2, 3);
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ final class MetaSQL {
|
||||
M_SEQUENCES_INCLUDING_SYSTEM_SEQUENCES.put(FIREBIRD, "select null catalog, null schema, trim(RDB$GENERATORS.RDB$GENERATOR_NAME) RDB$GENERATOR_NAME, 'BIGINT' type_name, null numeric_precision, null numeric_scale, nullif(RDB$GENERATORS.RDB$INITIAL_VALUE, 0) RDB$INITIAL_VALUE, nullif(RDB$GENERATORS.RDB$GENERATOR_INCREMENT, 1) RDB$GENERATOR_INCREMENT, null min_value, null max_value, null cycle, null cache from RDB$GENERATORS order by RDB$GENERATORS.RDB$GENERATOR_NAME");
|
||||
M_SEQUENCES_INCLUDING_SYSTEM_SEQUENCES.put(H2, "select null catalog, INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_SCHEMA, INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_NAME, 'BIGINT' type_name, null precision, null scale, null start_value, nullif(INFORMATION_SCHEMA.SEQUENCES.INCREMENT, 1) INCREMENT, nullif(INFORMATION_SCHEMA.SEQUENCES.MIN_VALUE, 1) MIN_VALUE, nullif(INFORMATION_SCHEMA.SEQUENCES.MAX_VALUE, 9223372036854775807) MAX_VALUE, INFORMATION_SCHEMA.SEQUENCES.IS_CYCLE, nullif(INFORMATION_SCHEMA.SEQUENCES.CACHE, 32) CACHE from INFORMATION_SCHEMA.SEQUENCES where INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_SCHEMA in (cast(? as varchar(2147483647))) order by INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_SCHEMA, INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_NAME");
|
||||
M_SEQUENCES_INCLUDING_SYSTEM_SEQUENCES.put(HSQLDB, "select null as catalog, INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_SCHEMA, INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_NAME, INFORMATION_SCHEMA.SEQUENCES.DATA_TYPE, INFORMATION_SCHEMA.SEQUENCES.NUMERIC_PRECISION, INFORMATION_SCHEMA.SEQUENCES.NUMERIC_SCALE, INFORMATION_SCHEMA.SEQUENCES.START_WITH, INFORMATION_SCHEMA.SEQUENCES.INCREMENT, INFORMATION_SCHEMA.SEQUENCES.MINIMUM_VALUE, INFORMATION_SCHEMA.SEQUENCES.MAXIMUM_VALUE, case when INFORMATION_SCHEMA.SEQUENCES.CYCLE_OPTION is not distinct from 'YES' then true else false end as CYCLE_OPTION, null as cache from INFORMATION_SCHEMA.SEQUENCES where INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_SCHEMA in (cast(? as varchar(128))) order by INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_SCHEMA, INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_NAME");
|
||||
M_SEQUENCES_INCLUDING_SYSTEM_SEQUENCES.put(POSTGRES, "with schemas(schema) as (select v.c1 from (values (?)) as v (c1)) (select null as catalog, information_schema.sequences.sequence_schema, information_schema.sequences.sequence_name, information_schema.sequences.data_type, information_schema.sequences.numeric_precision, information_schema.sequences.numeric_scale, nullif(cast(information_schema.sequences.start_value as bigint), 1) as start_value, nullif(cast(information_schema.sequences.increment as bigint), 1) as increment, nullif(cast(information_schema.sequences.minimum_value as bigint), 1) as minimum_value, nullif(cast(information_schema.sequences.maximum_value as decimal), (power(cast(2 as decimal), cast((information_schema.sequences.numeric_precision - 1) as decimal)) - 1)) as maximum_value, cast(information_schema.sequences.cycle_option as boolean) as cycle_option, null as cache from information_schema.sequences where information_schema.sequences.sequence_schema in (select schemas.schema from schemas)) union all (select null, alias_14763223.nspname, alias_75351712.relname, alias_109453426.typname, information_schema._pg_numeric_precision(alias_109453426.typbasetype, alias_109453426.typtypmod), 0, pg_catalog.pg_sequence.seqstart, pg_catalog.pg_sequence.seqmin, pg_catalog.pg_sequence.seqmax, pg_catalog.pg_sequence.seqincrement, pg_catalog.pg_sequence.seqcycle, null as cache from (pg_catalog.pg_sequence join (pg_catalog.pg_class as alias_75351712 join pg_catalog.pg_namespace as alias_14763223 on alias_75351712.relnamespace = alias_14763223.oid) on pg_catalog.pg_sequence.seqrelid = alias_75351712.oid join pg_catalog.pg_type as alias_109453426 on pg_catalog.pg_sequence.seqtypid = alias_109453426.oid) where (alias_14763223.nspname in (select schemas.schema from schemas) and alias_75351712.oid in (select pg_catalog.pg_depend.objid from pg_catalog.pg_depend where (pg_catalog.pg_depend.deptype = 'i' and pg_catalog.pg_depend.classid = 'pg_class'::regclass)))) order by 2, 3");
|
||||
M_SEQUENCES_INCLUDING_SYSTEM_SEQUENCES.put(POSTGRES, "with schemas(schema) as (select v.c1 from (values (?)) as v (c1)) (select null as catalog, information_schema.sequences.sequence_schema, information_schema.sequences.sequence_name, information_schema.sequences.data_type, information_schema.sequences.numeric_precision, information_schema.sequences.numeric_scale, nullif(cast(information_schema.sequences.start_value as bigint), 1) as start_value, nullif(cast(information_schema.sequences.increment as bigint), 1) as increment, nullif(cast(information_schema.sequences.minimum_value as bigint), 1) as minimum_value, nullif(cast(information_schema.sequences.maximum_value as decimal), (power(cast(2 as decimal), cast((information_schema.sequences.numeric_precision - 1) as decimal)) - 1)) as maximum_value, cast(information_schema.sequences.cycle_option as boolean) as cycle_option, null as cache from information_schema.sequences where information_schema.sequences.sequence_schema in (select schemas.schema from schemas)) union all (select null, alias_14763223.nspname, alias_75351712.relname, alias_109453426.typname, information_schema._pg_numeric_precision(alias_109453426.typbasetype, alias_109453426.typtypmod), 0, pg_catalog.pg_sequence.seqstart, pg_catalog.pg_sequence.seqincrement, pg_catalog.pg_sequence.seqmin, pg_catalog.pg_sequence.seqmax, pg_catalog.pg_sequence.seqcycle, null as cache from (pg_catalog.pg_sequence join (pg_catalog.pg_class as alias_75351712 join pg_catalog.pg_namespace as alias_14763223 on alias_75351712.relnamespace = alias_14763223.oid) on pg_catalog.pg_sequence.seqrelid = alias_75351712.oid join pg_catalog.pg_type as alias_109453426 on pg_catalog.pg_sequence.seqtypid = alias_109453426.oid) where (alias_14763223.nspname in (select schemas.schema from schemas) and alias_75351712.oid in (select pg_catalog.pg_depend.objid from pg_catalog.pg_depend where (pg_catalog.pg_depend.deptype = 'i' and pg_catalog.pg_depend.classid = 'pg_class'::regclass)))) order by 2, 3");
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user