mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 05:03:57 +00:00
CockroachDB analysis #112
This commit is contained in:
@@ -122,7 +122,13 @@ const driver = {
|
|||||||
return { rows: res.rows.map(row => zipDataRow(row, columns)), columns };
|
return { rows: res.rows.map(row => zipDataRow(row, columns)), columns };
|
||||||
},
|
},
|
||||||
async stream(client, sql, options) {
|
async stream(client, sql, options) {
|
||||||
const sqlSplitted = identify(sql, { dialect: 'psql', strict: false });
|
let sqlSplitted;
|
||||||
|
try {
|
||||||
|
sqlSplitted = identify(sql, { dialect: 'psql', strict: false });
|
||||||
|
} catch (e) {
|
||||||
|
// workaround
|
||||||
|
sqlSplitted = [{ text: sql }];
|
||||||
|
}
|
||||||
|
|
||||||
for (const sqlItem of sqlSplitted) {
|
for (const sqlItem of sqlSplitted) {
|
||||||
await runStreamItem(client, sqlItem.text, options);
|
await runStreamItem(client, sqlItem.text, options);
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ from
|
|||||||
AND n.nspname !~ '^pg_toast'
|
AND n.nspname !~ '^pg_toast'
|
||||||
ORDER BY a.attnum
|
ORDER BY a.attnum
|
||||||
) as tabledefinition
|
) as tabledefinition
|
||||||
|
inner join information_schema.tables on tables.table_schema = tabledefinition.nspname and tables.table_name = tabledefinition.relname
|
||||||
|
and tables.table_type not like '%VIEW%'
|
||||||
where ('tables:' || nspname || '.' || relname) =OBJECT_ID_CONDITION
|
where ('tables:' || nspname || '.' || relname) =OBJECT_ID_CONDITION
|
||||||
group by relname, nspname, oid
|
group by relname, nspname, oid
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user