Browse Source

Merge pull request #6965 from nocodb/fix/pg-df-dt

fix: regex to get default value
pull/6972/head
Raju Udava 1 year ago committed by GitHub
parent
commit
9c64457bd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/nocodb/src/db/sql-client/lib/pg/PgClient.ts
  2. 13
      packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts

2
packages/nocodb/src/db/sql-client/lib/pg/PgClient.ts

@ -891,7 +891,7 @@ class PGClient extends KnexClient {
// column['unique'] = response.rows[i]['cst'].indexOf('UNIQUE') === -1 ? false : true;
column.cdf = response.rows[i].cdf
? response.rows[i].cdf.replace(/::\w+$/, '').replace(/^'|'$/g, '')
? response.rows[i].cdf.replace(/::[\w ]+$/, '').replace(/^'|'$/g, '')
: response.rows[i].cdf;
// todo : need to find column comment

13
packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts

@ -143,6 +143,19 @@ export class ExportService {
}
}
}
// pg default value fix
if (source.type === 'pg') {
if (column.cdf) {
// check if column.cdf has unmatched single quotes
const matches = column.cdf.match(/'/g);
if (matches && matches.length % 2 !== 0) {
// if so remove after last single quote
const lastQuoteIndex = column.cdf.lastIndexOf("'");
column.cdf = column.cdf.substring(0, lastQuoteIndex);
}
}
}
}
for (const view of model.views) {

Loading…
Cancel
Save