#112 fix for CockroachDB

This commit is contained in:
Jan Prochazka
2021-05-13 12:05:56 +02:00
parent ae7697f655
commit 216ef7736b
2 changed files with 4 additions and 3 deletions

View File

@@ -99,6 +99,7 @@ const driver = {
async connect({ server, port, user, password, database, ssl }) {
const client = new pg.Client({
// connectionString: 'postgres://root@localhost:26257/postgres?sslmode=disabke'
host: server,
port,
user,

View File

@@ -1,9 +1,9 @@
module.exports = `
with pkey as
(
select cc.conrelid, format(E'create constraint %I primary key(%s);\\n', cc.conname,
string_agg(a.attname, ', '
order by array_position(cc.conkey, a.attnum))) pkey
select cc.conrelid, 'create constraint ' || cc.conname || ' primary key(' ||
string_agg(a.attname, ', ' order by array_position(cc.conkey, a.attnum)) || ');\\n'
pkey
from pg_catalog.pg_constraint cc
join pg_catalog.pg_class c on c.oid = cc.conrelid
join pg_catalog.pg_attribute a on a.attrelid = cc.conrelid