@bytebase/dbhub 1.2.5 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,17 +3,18 @@ import {
3
3
  } from "./chunk-FU2ZJE4E.js";
4
4
  import {
5
5
  quoteIdentifier
6
- } from "./chunk-JFWX35TB.js";
6
+ } from "./chunk-X2EC47W4.js";
7
7
  import {
8
8
  SQLRowLimiter,
9
9
  closeQuietly
10
- } from "./chunk-6QETXS44.js";
10
+ } from "./chunk-YIGJHEU6.js";
11
+ import "./chunk-ABTVMHD6.js";
11
12
  import {
12
13
  ConnectorRegistry,
13
14
  SafeURL,
14
15
  obfuscateDSNPassword,
15
16
  splitSQLStatements
16
- } from "./chunk-MF6LSVWK.js";
17
+ } from "./chunk-IXC4NQGC.js";
17
18
 
18
19
  // src/connectors/postgres/index.ts
19
20
  import fs from "fs";
@@ -62,6 +63,7 @@ var PostgresDSNParser = class {
62
63
  async parse(dsn, config) {
63
64
  const connectionTimeoutSeconds = config?.connectionTimeoutSeconds;
64
65
  const queryTimeoutSeconds = config?.queryTimeoutSeconds;
66
+ const poolMaxConnections = config?.poolMaxConnections;
65
67
  if (!this.isValidDSN(dsn)) {
66
68
  const obfuscatedDSN = obfuscateDSNPassword(dsn);
67
69
  const expectedFormat = this.getSampleDSN();
@@ -121,6 +123,9 @@ Expected: ${expectedFormat}`
121
123
  poolConfig.statement_timeout = queryTimeoutMs;
122
124
  poolConfig.query_timeout = queryTimeoutMs + POSTGRES_CLIENT_QUERY_TIMEOUT_GRACE_MS;
123
125
  }
126
+ if (poolMaxConnections !== void 0) {
127
+ poolConfig.max = poolMaxConnections;
128
+ }
124
129
  return poolConfig;
125
130
  } catch (error) {
126
131
  if (error instanceof FailedToReadCertificate) {
@@ -297,7 +302,7 @@ var PostgresConnector = class _PostgresConnector {
297
302
  `
298
303
  SELECT
299
304
  i.relname as index_name,
300
- array_agg(a.attname) as column_names,
305
+ array_agg(a.attname::text) as column_names,
301
306
  ix.indisunique as is_unique,
302
307
  ix.indisprimary as is_primary
303
308
  FROM
@@ -595,7 +600,8 @@ var PostgresConnector = class _PostgresConnector {
595
600
  if (statements.length === 1) {
596
601
  const { sql: processedStatement, probeApplied } = SQLRowLimiter.applyMaxRowsWithTruncationProbe(
597
602
  statements[0],
598
- options.maxRows
603
+ options.maxRows,
604
+ "postgres"
599
605
  );
600
606
  if (options.readonly) {
601
607
  await client.query("BEGIN READ ONLY");
@@ -640,7 +646,8 @@ var PostgresConnector = class _PostgresConnector {
640
646
  for (let statement of statements) {
641
647
  const { sql: processedStatement, probeApplied } = SQLRowLimiter.applyMaxRowsWithTruncationProbe(
642
648
  statement,
643
- options.maxRows
649
+ options.maxRows,
650
+ "postgres"
644
651
  );
645
652
  const result = await client.query(processedStatement);
646
653
  const resultSet = {