Browse Source

refactor: added comment for reference

pull/6714/head
mertmit 1 year ago
parent
commit
57bdefb8f1
  1. 10
      packages/nocodb/src/db/sql-client/lib/pg/PgClient.ts

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

@ -783,11 +783,15 @@ class PGClient extends KnexClient {
try { try {
const versionQuery = await this.sqlClient.raw('SELECT version()'); const versionQuery = await this.sqlClient.raw('SELECT version()');
const version = versionQuery.rows[0]?.version // Example output of `SELECT version()`
// PostgreSQL 14.4 (Debian 14.4-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
const majorVersion = versionQuery.rows[0]?.version
?.split(' ')?.[1] ?.split(' ')?.[1]
?.split('.')?.[0]; ?.split('.')?.[0];
const identitySelector = +version >= 10 ? 'c.is_identity as ii,' : ''; // PostgreSQL 10 and above supports identity columns
const identitySelector =
+majorVersion >= 10 ? 'c.is_identity as ii,' : '';
args.databaseName = this.connectionConfig.connection.database; args.databaseName = this.connectionConfig.connection.database;
const response = await this.sqlClient.raw( const response = await this.sqlClient.raw(
@ -903,7 +907,7 @@ class PGClient extends KnexClient {
} }
// handle identity column // handle identity column
if (+version >= 10) { if (+majorVersion >= 10) {
if (response.rows[i].ii === 'YES') { if (response.rows[i].ii === 'YES') {
column.ai = true; column.ai = true;
} }

Loading…
Cancel
Save