|
|
|
|
@ -53,7 +53,7 @@ final class MetaSQL {
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
|
|
|
|
|
M_UNIQUE_KEYS.put(DUCKDB, "select duckdb_constraints.database_name, duckdb_constraints.schema_name, duckdb_constraints.table_name, ((((((duckdb_constraints.database_name || '__') || duckdb_constraints.schema_name) || '__') || duckdb_constraints.table_name) || '__') || duckdb_constraints.constraint_text) constraint_text, unnest(duckdb_constraints.constraint_column_names) constraint_column_names, unnest(duckdb_constraints.constraint_column_indexes) constraint_column_indexes from duckdb_constraints() where (duckdb_constraints.constraint_type = 'UNIQUE' and duckdb_constraints.schema_name in (cast(? as varchar)))");
|
|
|
|
|
M_UNIQUE_KEYS.put(DUCKDB, "select duckdb_constraints.database_name, duckdb_constraints.schema_name, duckdb_constraints.table_name, (duckdb_constraints.database_name || '__' || duckdb_constraints.schema_name || '__' || duckdb_constraints.table_name || '__' || duckdb_constraints.constraint_text) constraint_text, unnest(duckdb_constraints.constraint_column_names) constraint_column_names, unnest(duckdb_constraints.constraint_column_indexes) constraint_column_indexes from duckdb_constraints() where (duckdb_constraints.constraint_type = 'UNIQUE' and duckdb_constraints.schema_name in (cast(? as varchar)))");
|
|
|
|
|
M_UNIQUE_KEYS.put(FIREBIRD, "select null catalog, null schema, trim(RDB$RELATION_CONSTRAINTS.RDB$RELATION_NAME) RDB$RELATION_NAME, trim(RDB$RELATION_CONSTRAINTS.RDB$CONSTRAINT_NAME) RDB$CONSTRAINT_NAME, trim(RDB$INDEX_SEGMENTS.RDB$FIELD_NAME) RDB$FIELD_NAME, RDB$INDEX_SEGMENTS.RDB$FIELD_POSITION from RDB$RELATION_CONSTRAINTS join RDB$INDEX_SEGMENTS on RDB$INDEX_SEGMENTS.RDB$INDEX_NAME = RDB$RELATION_CONSTRAINTS.RDB$INDEX_NAME where RDB$RELATION_CONSTRAINTS.RDB$CONSTRAINT_TYPE = 'UNIQUE' order by RDB$RELATION_CONSTRAINTS.RDB$CONSTRAINT_NAME asc, RDB$INDEX_SEGMENTS.RDB$FIELD_POSITION asc");
|
|
|
|
|
M_UNIQUE_KEYS.put(H2, "select INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_CATALOG, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.ORDINAL_POSITION from (INFORMATION_SCHEMA.KEY_COLUMN_USAGE left outer join INFORMATION_SCHEMA.TABLE_CONSTRAINTS alias_10316587 on (INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_CATALOG = alias_10316587.CONSTRAINT_CATALOG and INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_SCHEMA = alias_10316587.CONSTRAINT_SCHEMA and INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME = alias_10316587.CONSTRAINT_NAME)) where (alias_10316587.CONSTRAINT_TYPE in ('UNIQUE') and alias_10316587.TABLE_SCHEMA in (cast(? as varchar(128)))) order by INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA asc, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME asc, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME asc, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.ORDINAL_POSITION asc");
|
|
|
|
|
M_UNIQUE_KEYS.put(HSQLDB, "select INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_CATALOG, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.ORDINAL_POSITION from (INFORMATION_SCHEMA.KEY_COLUMN_USAGE left outer join INFORMATION_SCHEMA.TABLE_CONSTRAINTS as alias_10316587 on (INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_CATALOG = alias_10316587.CONSTRAINT_CATALOG and INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_SCHEMA = alias_10316587.CONSTRAINT_SCHEMA and INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME = alias_10316587.CONSTRAINT_NAME)) where (alias_10316587.CONSTRAINT_TYPE = 'UNIQUE' and alias_10316587.TABLE_SCHEMA in (cast(? as varchar(128)))) order by INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA asc, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME asc, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME asc, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.ORDINAL_POSITION asc");
|
|
|
|
|
@ -126,6 +126,7 @@ final class MetaSQL {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
M_SEQUENCES.put(DERBY, "select cast(null as varchar(32672)) as catalog, alias_8805161.SCHEMANAME, SYS.SYSSEQUENCES.SEQUENCENAME, SYS.SYSSEQUENCES.SEQUENCEDATATYPE, cast(null as int) as numeric_precision, cast(null as int) as numeric_scale, nullif(SYS.SYSSEQUENCES.STARTVALUE, 1) as STARTVALUE, nullif(SYS.SYSSEQUENCES.INCREMENT, 1) as INCREMENT, nullif(SYS.SYSSEQUENCES.MINIMUMVALUE, case when cast(SYS.SYSSEQUENCES.SEQUENCEDATATYPE as varchar(32672)) = 'SMALLINT' then -32768 when cast(SYS.SYSSEQUENCES.SEQUENCEDATATYPE as varchar(32672)) = 'INTEGER' then -2147483648 when cast(SYS.SYSSEQUENCES.SEQUENCEDATATYPE as varchar(32672)) = 'BIGINT' then -9223372036854775808 end) as MINIMUMVALUE, nullif(SYS.SYSSEQUENCES.MAXIMUMVALUE, case when cast(SYS.SYSSEQUENCES.SEQUENCEDATATYPE as varchar(32672)) = 'SMALLINT' then 32767 when cast(SYS.SYSSEQUENCES.SEQUENCEDATATYPE as varchar(32672)) = 'INTEGER' then 2147483647 when cast(SYS.SYSSEQUENCES.SEQUENCEDATATYPE as varchar(32672)) = 'BIGINT' then 9223372036854775807 end) as MAXIMUMVALUE, (SYS.SYSSEQUENCES.CYCLEOPTION = 'Y') as CYCLEOPTION, cast(null as bigint) as cache from (SYS.SYSSEQUENCES join SYS.SYSSCHEMAS as alias_8805161 on SYS.SYSSEQUENCES.SCHEMAID = alias_8805161.SCHEMAID) where cast(alias_8805161.SCHEMANAME as varchar(32672)) in (cast(? as varchar(32672))) order by alias_8805161.SCHEMANAME, SYS.SYSSEQUENCES.SEQUENCENAME");
|
|
|
|
|
@ -133,8 +134,8 @@ final class MetaSQL {
|
|
|
|
|
M_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 where RDB$GENERATORS.RDB$GENERATOR_NAME not in (select RDB$RELATION_FIELDS.RDB$GENERATOR_NAME from RDB$RELATION_FIELDS where (RDB$RELATION_FIELDS.RDB$GENERATOR_NAME is not null and RDB$RELATION_FIELDS.RDB$IDENTITY_TYPE = 1)) order by RDB$GENERATORS.RDB$GENERATOR_NAME");
|
|
|
|
|
M_SEQUENCES.put(H2, "select null catalog, INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_SCHEMA, INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_NAME, SEQUENCES.DATA_TYPE type_name, null precision, null scale, null start_value, nullif(INFORMATION_SCHEMA.SEQUENCES.INCREMENT, 1) INCREMENT, nullif(SEQUENCES.MINIMUM_VALUE, 1) MIN_VALUE, nullif(SEQUENCES.MAXIMUM_VALUE, 9223372036854775807) MAX_VALUE, (SEQUENCES.CYCLE_OPTION = 'YES') IS_CYCLE, nullif(INFORMATION_SCHEMA.SEQUENCES.CACHE, 32) CACHE from INFORMATION_SCHEMA.SEQUENCES where (INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_SCHEMA in (cast(? as varchar)) and upper(INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_NAME) not like 'SYSTEM!_SEQUENCE!_%' escape '!') order by INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_SCHEMA, INFORMATION_SCHEMA.SEQUENCES.SEQUENCE_NAME");
|
|
|
|
|
M_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.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, cast(null as bigint) as cache from information_schema.sequences where (information_schema.sequences.sequence_schema in (select schemas.schema from schemas) and (information_schema.sequences.sequence_schema, information_schema.sequences.sequence_name) not in (select information_schema.columns.table_schema, (((information_schema.columns.table_name || '_') || information_schema.columns.column_name) || '_seq') from information_schema.columns where (information_schema.columns.column_default = (('nextval(''' || ((information_schema.columns.table_name || '_') || information_schema.columns.column_name)) || '_seq''::regclass)') or information_schema.columns.column_default = (('nextval(''' || ((((information_schema.columns.table_schema || '.') || information_schema.columns.table_name) || '_') || information_schema.columns.column_name)) || '_seq''::regclass)'))))) union all (select '', '', '', '', 0, 0, 0, 0, 0, 0, false, 0 where false) order by 2, 3");
|
|
|
|
|
M_SEQUENCES.put(YUGABYTEDB, "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, cast(null as bigint) as cache from information_schema.sequences where (information_schema.sequences.sequence_schema in (select schemas.schema from schemas) and (information_schema.sequences.sequence_schema, information_schema.sequences.sequence_name) not in (select information_schema.columns.table_schema, (((information_schema.columns.table_name || '_') || information_schema.columns.column_name) || '_seq') from information_schema.columns where (information_schema.columns.column_default = (('nextval(''' || ((information_schema.columns.table_name || '_') || information_schema.columns.column_name)) || '_seq''::regclass)') or information_schema.columns.column_default = (('nextval(''' || ((((information_schema.columns.table_schema || '.') || information_schema.columns.table_name) || '_') || information_schema.columns.column_name)) || '_seq''::regclass)'))))) union all (select '', '', '', '', 0, 0, 0, 0, 0, 0, false, 0 where false) order by 2, 3");
|
|
|
|
|
M_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, cast(null as bigint) as cache from information_schema.sequences where (information_schema.sequences.sequence_schema in (select schemas.schema from schemas) and (information_schema.sequences.sequence_schema, information_schema.sequences.sequence_name) not in (select information_schema.columns.table_schema, (information_schema.columns.table_name || '_' || information_schema.columns.column_name || '_seq') from information_schema.columns where (information_schema.columns.column_default = ('nextval(''' || information_schema.columns.table_name || '_' || information_schema.columns.column_name || '_seq''::regclass)') or information_schema.columns.column_default = ('nextval(''' || information_schema.columns.table_schema || '.' || information_schema.columns.table_name || '_' || information_schema.columns.column_name || '_seq''::regclass)'))))) union all (select '', '', '', '', 0, 0, 0, 0, 0, 0, false, 0 where false) order by 2, 3");
|
|
|
|
|
M_SEQUENCES.put(YUGABYTEDB, "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, cast(null as bigint) as cache from information_schema.sequences where (information_schema.sequences.sequence_schema in (select schemas.schema from schemas) and (information_schema.sequences.sequence_schema, information_schema.sequences.sequence_name) not in (select information_schema.columns.table_schema, (information_schema.columns.table_name || '_' || information_schema.columns.column_name || '_seq') from information_schema.columns where (information_schema.columns.column_default = ('nextval(''' || information_schema.columns.table_name || '_' || information_schema.columns.column_name || '_seq''::regclass)') or information_schema.columns.column_default = ('nextval(''' || information_schema.columns.table_schema || '.' || information_schema.columns.table_name || '_' || information_schema.columns.column_name || '_seq''::regclass)'))))) union all (select '', '', '', '', 0, 0, 0, 0, 0, 0, false, 0 where false) order by 2, 3");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -262,20 +263,22 @@ final class MetaSQL {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
M_SOURCES.put(CLICKHOUSE, "select system.tables.database catalog, system.tables.database, system.tables.table, system.tables.create_table_query from system.tables where (system.tables.database in (?) and system.tables.engine = 'View')");
|
|
|
|
|
M_SOURCES.put(DERBY, "select cast(null as varchar(32672)) as catalog, alias_57844683.SCHEMANAME, SYS.SYSTABLES.TABLENAME, SYS.SYSVIEWS.VIEWDEFINITION from (SYS.SYSTABLES join SYS.SYSSCHEMAS as alias_57844683 on SYS.SYSTABLES.SCHEMAID = alias_57844683.SCHEMAID) left outer join SYS.SYSVIEWS on SYS.SYSTABLES.TABLEID = SYS.SYSVIEWS.TABLEID where cast(alias_57844683.SCHEMANAME as varchar(32672)) in (cast(? as varchar(32672))) order by alias_57844683.SCHEMANAME, SYS.SYSTABLES.TABLENAME");
|
|
|
|
|
M_SOURCES.put(DUCKDB, "select duckdb_views.database_name, duckdb_views.schema_name, duckdb_views.view_name, duckdb_views.sql from duckdb_views() where duckdb_views.schema_name in (cast(? as varchar))");
|
|
|
|
|
M_SOURCES.put(FIREBIRD, "select null catalog, null schema, trim(RDB$RELATIONS.RDB$RELATION_NAME), case when lower(RDB$RELATIONS.RDB$VIEW_SOURCE) like 'create%' then trim(RDB$RELATIONS.RDB$VIEW_SOURCE) else ((('create view \"' || trim(RDB$RELATIONS.RDB$RELATION_NAME)) || '\" as ') || RDB$RELATIONS.RDB$VIEW_SOURCE) end view_source from RDB$RELATIONS order by trim(RDB$RELATIONS.RDB$RELATION_NAME)");
|
|
|
|
|
M_SOURCES.put(H2, "select INFORMATION_SCHEMA.VIEWS.TABLE_CATALOG, INFORMATION_SCHEMA.VIEWS.TABLE_SCHEMA, INFORMATION_SCHEMA.VIEWS.TABLE_NAME, ((('create view \"' || INFORMATION_SCHEMA.VIEWS.TABLE_NAME) || '\" as ') || INFORMATION_SCHEMA.VIEWS.VIEW_DEFINITION) VIEW_DEFINITION from INFORMATION_SCHEMA.VIEWS where INFORMATION_SCHEMA.VIEWS.TABLE_SCHEMA in (cast(? as varchar)) order by INFORMATION_SCHEMA.VIEWS.TABLE_SCHEMA, INFORMATION_SCHEMA.VIEWS.TABLE_NAME");
|
|
|
|
|
M_SOURCES.put(H2, "select INFORMATION_SCHEMA.VIEWS.TABLE_CATALOG, INFORMATION_SCHEMA.VIEWS.TABLE_SCHEMA, INFORMATION_SCHEMA.VIEWS.TABLE_NAME, ('create view \"' || INFORMATION_SCHEMA.VIEWS.TABLE_NAME || '\" as ' || INFORMATION_SCHEMA.VIEWS.VIEW_DEFINITION) VIEW_DEFINITION from INFORMATION_SCHEMA.VIEWS where INFORMATION_SCHEMA.VIEWS.TABLE_SCHEMA in (cast(? as varchar)) order by INFORMATION_SCHEMA.VIEWS.TABLE_SCHEMA, INFORMATION_SCHEMA.VIEWS.TABLE_NAME");
|
|
|
|
|
M_SOURCES.put(HSQLDB, "select INFORMATION_SCHEMA.VIEWS.TABLE_CATALOG, INFORMATION_SCHEMA.VIEWS.TABLE_SCHEMA, INFORMATION_SCHEMA.VIEWS.TABLE_NAME, INFORMATION_SCHEMA.VIEWS.VIEW_DEFINITION from INFORMATION_SCHEMA.VIEWS where INFORMATION_SCHEMA.VIEWS.TABLE_SCHEMA in (cast(? as varchar(128))) order by INFORMATION_SCHEMA.VIEWS.TABLE_SCHEMA, INFORMATION_SCHEMA.VIEWS.TABLE_NAME");
|
|
|
|
|
M_SOURCES.put(MARIADB, "select information_schema.VIEWS.TABLE_CATALOG, information_schema.VIEWS.TABLE_SCHEMA, information_schema.VIEWS.TABLE_NAME, case when lower(information_schema.VIEWS.VIEW_DEFINITION) like 'create%' then information_schema.VIEWS.VIEW_DEFINITION else concat(concat(concat('create view `', information_schema.VIEWS.TABLE_NAME), '` as '), information_schema.VIEWS.VIEW_DEFINITION) end as VIEW_DEFINITION from information_schema.VIEWS where information_schema.VIEWS.TABLE_SCHEMA in (?) order by information_schema.VIEWS.TABLE_SCHEMA, information_schema.VIEWS.TABLE_NAME");
|
|
|
|
|
M_SOURCES.put(MYSQL, "select information_schema.VIEWS.TABLE_CATALOG, information_schema.VIEWS.TABLE_SCHEMA, information_schema.VIEWS.TABLE_NAME, case when lower(information_schema.VIEWS.VIEW_DEFINITION) like 'create%' then information_schema.VIEWS.VIEW_DEFINITION else concat(concat(concat('create view `', information_schema.VIEWS.TABLE_NAME), '` as '), information_schema.VIEWS.VIEW_DEFINITION) end as VIEW_DEFINITION from information_schema.VIEWS where information_schema.VIEWS.TABLE_SCHEMA in (?) order by information_schema.VIEWS.TABLE_SCHEMA, information_schema.VIEWS.TABLE_NAME");
|
|
|
|
|
M_SOURCES.put(POSTGRES, "select current_database(), alias_5049504.nspname, c.relname, (((case when c.relkind = 'm' then 'create materialized view \"' else 'create view \"' end || c.relname) || '\" as ') || pg_get_viewdef(c.oid)) from (pg_catalog.pg_class as c join pg_catalog.pg_namespace as alias_5049504 on c.relnamespace = alias_5049504.oid) where (c.relkind in ('v', 'm') and alias_5049504.nspname in (?)) order by 1, 2, 3");
|
|
|
|
|
M_SOURCES.put(MARIADB, "select information_schema.VIEWS.TABLE_CATALOG, information_schema.VIEWS.TABLE_SCHEMA, information_schema.VIEWS.TABLE_NAME, case when lower(information_schema.VIEWS.VIEW_DEFINITION) like 'create%' then information_schema.VIEWS.VIEW_DEFINITION else concat('create view `', information_schema.VIEWS.TABLE_NAME, '` as ', information_schema.VIEWS.VIEW_DEFINITION) end as VIEW_DEFINITION from information_schema.VIEWS where information_schema.VIEWS.TABLE_SCHEMA in (?) order by information_schema.VIEWS.TABLE_SCHEMA, information_schema.VIEWS.TABLE_NAME");
|
|
|
|
|
M_SOURCES.put(MYSQL, "select information_schema.VIEWS.TABLE_CATALOG, information_schema.VIEWS.TABLE_SCHEMA, information_schema.VIEWS.TABLE_NAME, case when lower(information_schema.VIEWS.VIEW_DEFINITION) like 'create%' then information_schema.VIEWS.VIEW_DEFINITION else concat('create view `', information_schema.VIEWS.TABLE_NAME, '` as ', information_schema.VIEWS.VIEW_DEFINITION) end as VIEW_DEFINITION from information_schema.VIEWS where information_schema.VIEWS.TABLE_SCHEMA in (?) order by information_schema.VIEWS.TABLE_SCHEMA, information_schema.VIEWS.TABLE_NAME");
|
|
|
|
|
M_SOURCES.put(POSTGRES, "select current_database(), alias_5049504.nspname, c.relname, (case when c.relkind = 'm' then 'create materialized view \"' else 'create view \"' end || c.relname || '\" as ' || pg_get_viewdef(c.oid)) from (pg_catalog.pg_class as c join pg_catalog.pg_namespace as alias_5049504 on c.relnamespace = alias_5049504.oid) where (c.relkind in ('v', 'm') and alias_5049504.nspname in (?)) order by 1, 2, 3");
|
|
|
|
|
M_SOURCES.put(SQLITE, "select null as catalog, null as schema, sqlite_master.name, sqlite_master.sql from sqlite_master order by sqlite_master.name");
|
|
|
|
|
M_SOURCES.put(TRINO, "select '' TABLE_CATALOG, INFORMATION_SCHEMA.VIEWS.TABLE_SCHEMA, INFORMATION_SCHEMA.VIEWS.TABLE_NAME, case when lower(INFORMATION_SCHEMA.VIEWS.VIEW_DEFINITION) like 'create%' then INFORMATION_SCHEMA.VIEWS.VIEW_DEFINITION else ((('create view \"' || INFORMATION_SCHEMA.VIEWS.TABLE_NAME) || '\" as ') || INFORMATION_SCHEMA.VIEWS.VIEW_DEFINITION) end VIEW_DEFINITION from INFORMATION_SCHEMA.VIEWS where INFORMATION_SCHEMA.VIEWS.TABLE_SCHEMA in (?) order by INFORMATION_SCHEMA.VIEWS.TABLE_SCHEMA, INFORMATION_SCHEMA.VIEWS.TABLE_NAME");
|
|
|
|
|
M_SOURCES.put(YUGABYTEDB, "select current_database(), alias_5049504.nspname, c.relname, (((case when c.relkind = 'm' then 'create materialized view \"' else 'create view \"' end || c.relname) || '\" as ') || pg_get_viewdef(c.oid)) from (pg_catalog.pg_class as c join pg_catalog.pg_namespace as alias_5049504 on c.relnamespace = alias_5049504.oid) where (c.relkind in ('v', 'm') and alias_5049504.nspname in (?)) order by 1, 2, 3");
|
|
|
|
|
M_SOURCES.put(YUGABYTEDB, "select current_database(), alias_5049504.nspname, c.relname, (case when c.relkind = 'm' then 'create materialized view \"' else 'create view \"' end || c.relname || '\" as ' || pg_get_viewdef(c.oid)) from (pg_catalog.pg_class as c join pg_catalog.pg_namespace as alias_5049504 on c.relnamespace = alias_5049504.oid) where (c.relkind in ('v', 'm') and alias_5049504.nspname in (?)) order by 1, 2, 3");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -470,6 +473,7 @@ final class MetaSQL {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|