@prisma/adapter-pg 7.11.0-dev.1 → 7.11.0-dev.11

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.
package/dist/index.d.mts CHANGED
@@ -9,10 +9,12 @@ import type { SqlResultSet } from '@prisma/driver-adapter-utils';
9
9
  import type { Transaction } from '@prisma/driver-adapter-utils';
10
10
 
11
11
  declare class PgQueryable<ClientT extends StdClient | TransactionClient> implements SqlQueryable {
12
+ #private;
12
13
  protected readonly client: ClientT;
13
14
  protected readonly pgOptions?: PrismaPgOptions | undefined;
14
15
  readonly provider = "postgres";
15
16
  readonly adapterName: string;
17
+ protected readonly serializeQueries: boolean;
16
18
  constructor(client: ClientT, pgOptions?: PrismaPgOptions | undefined);
17
19
  /**
18
20
  * Execute a query given as SQL, interpolating the given parameters.
@@ -30,6 +32,7 @@ declare class PgQueryable<ClientT extends StdClient | TransactionClient> impleme
30
32
  * marked as unhealthy.
31
33
  */
32
34
  protected performIO(query: SqlQuery): Promise<pg.QueryArrayResult<any>>;
35
+ protected sendQuery(query: SqlQuery): Promise<pg.QueryArrayResult<any>>;
33
36
  protected onError(error: unknown): never;
34
37
  }
35
38
 
@@ -47,6 +50,7 @@ export declare class PrismaPg implements SqlMigrationAwareDriverAdapterFactory {
47
50
  declare class PrismaPgAdapter extends PgQueryable<StdClient> implements SqlDriverAdapter {
48
51
  protected readonly pgOptions?: PrismaPgOptions | undefined;
49
52
  private readonly release?;
53
+ protected readonly serializeQueries = false;
50
54
  constructor(client: StdClient, pgOptions?: PrismaPgOptions | undefined, release?: (() => Promise<void>) | undefined);
51
55
  startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
52
56
  executeScript(script: string): Promise<void>;
@@ -57,11 +61,11 @@ declare class PrismaPgAdapter extends PgQueryable<StdClient> implements SqlDrive
57
61
 
58
62
  declare type PrismaPgOptions = {
59
63
  /**
60
- * The name of the schema to use in generated queries. When the adapter creates the pool itself
61
- * (i.e. it is given a config object or a connection string), it also sets the `search_path` of
62
- * every connection to this schema, so that raw queries resolve unqualified table names in this
63
- * schema, unless the config's `options` already set a `search_path`. Externally provided pools are left untouched; configure the search path on the pool
64
- * itself in that case, e.g. via `options: '-c search_path="mySchema"'`.
64
+ * The name of the schema to use in generated queries. Raw queries are not affected: they resolve
65
+ * unqualified names through the connection's `search_path`. Qualify the name in raw SQL
66
+ * (`"mySchema"."User"`), or set the search path on the database role
67
+ * (`ALTER ROLE ... SET search_path = ...`). The adapter does not set it itself, because behind a
68
+ * connection pooler in transaction mode a session setting is shared with the pooler's other clients.
65
69
  */
66
70
  schema?: string;
67
71
  /**
package/dist/index.d.ts CHANGED
@@ -9,10 +9,12 @@ import type { SqlResultSet } from '@prisma/driver-adapter-utils';
9
9
  import type { Transaction } from '@prisma/driver-adapter-utils';
10
10
 
11
11
  declare class PgQueryable<ClientT extends StdClient | TransactionClient> implements SqlQueryable {
12
+ #private;
12
13
  protected readonly client: ClientT;
13
14
  protected readonly pgOptions?: PrismaPgOptions | undefined;
14
15
  readonly provider = "postgres";
15
16
  readonly adapterName: string;
17
+ protected readonly serializeQueries: boolean;
16
18
  constructor(client: ClientT, pgOptions?: PrismaPgOptions | undefined);
17
19
  /**
18
20
  * Execute a query given as SQL, interpolating the given parameters.
@@ -30,6 +32,7 @@ declare class PgQueryable<ClientT extends StdClient | TransactionClient> impleme
30
32
  * marked as unhealthy.
31
33
  */
32
34
  protected performIO(query: SqlQuery): Promise<pg.QueryArrayResult<any>>;
35
+ protected sendQuery(query: SqlQuery): Promise<pg.QueryArrayResult<any>>;
33
36
  protected onError(error: unknown): never;
34
37
  }
35
38
 
@@ -47,6 +50,7 @@ export declare class PrismaPg implements SqlMigrationAwareDriverAdapterFactory {
47
50
  declare class PrismaPgAdapter extends PgQueryable<StdClient> implements SqlDriverAdapter {
48
51
  protected readonly pgOptions?: PrismaPgOptions | undefined;
49
52
  private readonly release?;
53
+ protected readonly serializeQueries = false;
50
54
  constructor(client: StdClient, pgOptions?: PrismaPgOptions | undefined, release?: (() => Promise<void>) | undefined);
51
55
  startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
52
56
  executeScript(script: string): Promise<void>;
@@ -57,11 +61,11 @@ declare class PrismaPgAdapter extends PgQueryable<StdClient> implements SqlDrive
57
61
 
58
62
  declare type PrismaPgOptions = {
59
63
  /**
60
- * The name of the schema to use in generated queries. When the adapter creates the pool itself
61
- * (i.e. it is given a config object or a connection string), it also sets the `search_path` of
62
- * every connection to this schema, so that raw queries resolve unqualified table names in this
63
- * schema, unless the config's `options` already set a `search_path`. Externally provided pools are left untouched; configure the search path on the pool
64
- * itself in that case, e.g. via `options: '-c search_path="mySchema"'`.
64
+ * The name of the schema to use in generated queries. Raw queries are not affected: they resolve
65
+ * unqualified names through the connection's `search_path`. Qualify the name in raw SQL
66
+ * (`"mySchema"."User"`), or set the search path on the database role
67
+ * (`ALTER ROLE ... SET search_path = ...`). The adapter does not set it itself, because behind a
68
+ * connection pooler in transaction mode a session setting is shared with the pooler's other clients.
65
69
  */
66
70
  schema?: string;
67
71
  /**
package/dist/index.js CHANGED
@@ -303,14 +303,17 @@ function normalize_array(element_normalizer) {
303
303
  function normalize_numeric(numeric) {
304
304
  return numeric;
305
305
  }
306
+ function expandYear(value) {
307
+ return value.replace(/^(\d{5,})(?=-)/, (_, year) => `+${year.padStart(6, "0")}`);
308
+ }
306
309
  function normalize_date(date) {
307
- return date;
310
+ return expandYear(date);
308
311
  }
309
312
  function normalize_timestamp(time) {
310
- return `${time.replace(" ", "T")}+00:00`;
313
+ return expandYear(`${time.replace(" ", "T")}+00:00`);
311
314
  }
312
315
  function normalize_timestamptz(time) {
313
- return time.replace(" ", "T").replace(/[+-]\d{2}(:\d{2})?$/, "+00:00");
316
+ return expandYear(time.replace(" ", "T").replace(/[+-]\d{2}(:\d{2})?$/, "+00:00"));
314
317
  }
315
318
  function normalize_time(time) {
316
319
  return time;
@@ -325,13 +328,16 @@ function normalize_timez(time) {
325
328
  const pad = (n) => String(n).padStart(2, "0");
326
329
  return `${pad(Math.floor(seconds / 3600))}:${pad(Math.floor(seconds / 60) % 60)}:${pad(seconds % 60)}${fraction}`;
327
330
  }
331
+ var SUPPORTED_MONEY_FORMAT = /^(?:(-)[\p{L}\p{Sc}]+|[\p{L}\p{Sc}]+(-)?)(\d{1,3}(?:,\d{3})*)(\.(?!\d{3}$)\d+)?$/u;
328
332
  function normalize_money(money) {
329
- if (!/^-?\$\d{1,3}(,\d{3})*\.\d{2}$/.test(money)) {
333
+ const match = SUPPORTED_MONEY_FORMAT.exec(money);
334
+ if (match === null) {
330
335
  throw new Error(
331
- `Unsupported money format "${money}": only the default lc_monetary format, such as -$1,234.50, is supported`
336
+ `Unsupported money format "${money}": expected a currency symbol directly followed by an amount with "," thousands separators and a "." decimal point, such as -\xA31,234.50`
332
337
  );
333
338
  }
334
- return money.replace(/[^\d.-]/g, "");
339
+ const [, signBeforeSymbol = "", signAfterSymbol = "", integer, fraction = ""] = match;
340
+ return `${signBeforeSymbol}${signAfterSymbol}${integer.replaceAll(",", "")}${fraction}`;
335
341
  }
336
342
  function normalize_xml(xml) {
337
343
  return xml;
@@ -631,6 +637,13 @@ function isTlsError(error) {
631
637
  // src/pg.ts
632
638
  var types2 = import_pg2.default.types;
633
639
  var debug = (0, import_driver_adapter_utils2.Debug)("prisma:driver-adapter:pg");
640
+ function isPgPoolLike(poolOrConfig) {
641
+ if (typeof poolOrConfig !== "object" || poolOrConfig === null) {
642
+ return false;
643
+ }
644
+ const candidate = poolOrConfig;
645
+ return typeof candidate.query === "function" && typeof candidate.connect === "function" && typeof candidate.end === "function" && typeof candidate.on === "function" && typeof candidate.removeListener === "function" && typeof candidate.options === "object" && candidate.options !== null;
646
+ }
634
647
  var PgQueryable = class {
635
648
  constructor(client, pgOptions) {
636
649
  this.client = client;
@@ -638,6 +651,14 @@ var PgQueryable = class {
638
651
  }
639
652
  provider = "postgres";
640
653
  adapterName = name;
654
+ // `pg.Client` and `pg.PoolClient` are single connections and don't support
655
+ // concurrent queries (deprecated in pg@8, an error in pg@9), so queries must
656
+ // be serialized. `pg.Pool` handles concurrency itself and must not be
657
+ // serialized, or the whole pool would be limited to one query at a time.
658
+ serializeQueries = true;
659
+ // Resolve-only lock: it tracks completion of the previous query and can
660
+ // never carry its error, so a failed query rejects only its own caller.
661
+ #queryLock = Promise.resolve();
641
662
  /**
642
663
  * Execute a query given as SQL, interpolating the given parameters.
643
664
  */
@@ -691,6 +712,20 @@ var PgQueryable = class {
691
712
  * marked as unhealthy.
692
713
  */
693
714
  async performIO(query) {
715
+ if (!this.serializeQueries) {
716
+ return this.sendQuery(query);
717
+ }
718
+ const previous = this.#queryLock;
719
+ let release;
720
+ this.#queryLock = new Promise((resolve) => release = resolve);
721
+ await previous;
722
+ try {
723
+ return await this.sendQuery(query);
724
+ } finally {
725
+ release();
726
+ }
727
+ }
728
+ async sendQuery(query) {
694
729
  const { sql, args } = query;
695
730
  const values = args.map((arg, i) => mapArg(arg, query.argTypes[i]));
696
731
  try {
@@ -727,13 +762,9 @@ var PgTransaction = class extends PgQueryable {
727
762
  }
728
763
  closed = false;
729
764
  runningStatements = 0;
765
+ #releaseError;
730
766
  async performIO(query) {
731
- if (this.closed) {
732
- throw new import_driver_adapter_utils2.DriverAdapterError({
733
- kind: "TransactionAlreadyClosed",
734
- cause: "The transaction has already been committed or rolled back"
735
- });
736
- }
767
+ this.assertOpen();
737
768
  this.runningStatements++;
738
769
  try {
739
770
  return await super.performIO(query);
@@ -741,6 +772,18 @@ var PgTransaction = class extends PgQueryable {
741
772
  this.runningStatements--;
742
773
  }
743
774
  }
775
+ async sendQuery(query) {
776
+ this.assertOpen();
777
+ return super.sendQuery(query);
778
+ }
779
+ assertOpen() {
780
+ if (this.closed) {
781
+ throw new import_driver_adapter_utils2.DriverAdapterError({
782
+ kind: "TransactionAlreadyClosed",
783
+ cause: "The transaction has already been committed or rolled back"
784
+ });
785
+ }
786
+ }
744
787
  /**
745
788
  * Closes the transaction at most once. Once the pool has lent the client to
746
789
  * a new owner, a second `release()` would corrupt the pool's bookkeeping, so
@@ -758,7 +801,7 @@ var PgTransaction = class extends PgQueryable {
758
801
  if (this.runningStatements > 0) {
759
802
  this.client.release(new Error("Transaction closed with a statement still running"));
760
803
  } else {
761
- this.client.release();
804
+ this.client.release(this.#releaseError);
762
805
  }
763
806
  }
764
807
  }
@@ -770,6 +813,12 @@ var PgTransaction = class extends PgQueryable {
770
813
  debug(`[js::rollback]`);
771
814
  this.close();
772
815
  }
816
+ onError(error) {
817
+ if (this.#releaseError === void 0 && !isDriverError(error)) {
818
+ this.#releaseError = error instanceof Error ? error : new Error(String(error));
819
+ }
820
+ super.onError(error);
821
+ }
773
822
  async createSavepoint(name2) {
774
823
  await this.executeRaw({ sql: `SAVEPOINT ${name2}`, args: [], argTypes: [] });
775
824
  }
@@ -786,6 +835,7 @@ var PrismaPgAdapter = class extends PgQueryable {
786
835
  this.pgOptions = pgOptions;
787
836
  this.release = release;
788
837
  }
838
+ serializeQueries = false;
789
839
  async startTransaction(isolationLevel) {
790
840
  const options = {
791
841
  usePhantomQuery: false
@@ -844,7 +894,7 @@ var PrismaPgAdapter = class extends PgQueryable {
844
894
  var PrismaPgAdapterFactory = class {
845
895
  constructor(poolOrConfig, options) {
846
896
  this.options = options;
847
- if (poolOrConfig instanceof import_pg2.default.Pool) {
897
+ if (isPgPoolLike(poolOrConfig)) {
848
898
  this.externalPool = poolOrConfig;
849
899
  this.config = poolOrConfig.options;
850
900
  } else if (typeof poolOrConfig === "string") {
@@ -860,12 +910,7 @@ var PrismaPgAdapterFactory = class {
860
910
  config;
861
911
  externalPool;
862
912
  async connect() {
863
- const client = this.externalPool ?? new import_pg2.default.Pool(withSearchPath(this.config, this.options?.schema));
864
- if (this.externalPool !== null && this.options?.schema !== void 0) {
865
- debug(
866
- `The search path is not set on externally provided pools, schema "${this.options.schema}" is only used for generated queries. Set the search path on the pool itself if raw queries need it.`
867
- );
868
- }
913
+ const client = this.externalPool ?? new import_pg2.default.Pool(this.config);
869
914
  const onIdleClientError = (err) => {
870
915
  debug(`Error from idle pool client: ${err.message} %O`, err);
871
916
  this.options?.onPoolError?.(err);
@@ -895,28 +940,6 @@ var PrismaPgAdapterFactory = class {
895
940
  });
896
941
  }
897
942
  };
898
- function withSearchPath(config, schema) {
899
- if (schema === void 0 || setsSearchPath(config.options)) {
900
- return config;
901
- }
902
- const searchPath = `-c search_path=${escapeOptionValue(quoteIdentifierIfNeeded(schema))},public`;
903
- return {
904
- ...config,
905
- options: config.options ? `${config.options} ${searchPath}` : searchPath
906
- };
907
- }
908
- function setsSearchPath(options) {
909
- return options !== void 0 && /(?:^|\s)(?:-c\s*|--)search[_-]path=/i.test(options);
910
- }
911
- function quoteIdentifierIfNeeded(name2) {
912
- if (/^[a-z_][a-z0-9_$]*$/.test(name2)) {
913
- return name2;
914
- }
915
- return `"${name2.replaceAll('"', '""')}"`;
916
- }
917
- function escapeOptionValue(value) {
918
- return value.replace(/[\\\s]/g, (char) => `\\${char}`);
919
- }
920
943
  // Annotate the CommonJS export names for ESM import in node:
921
944
  0 && (module.exports = {
922
945
  PrismaPg
package/dist/index.mjs CHANGED
@@ -267,14 +267,17 @@ function normalize_array(element_normalizer) {
267
267
  function normalize_numeric(numeric) {
268
268
  return numeric;
269
269
  }
270
+ function expandYear(value) {
271
+ return value.replace(/^(\d{5,})(?=-)/, (_, year) => `+${year.padStart(6, "0")}`);
272
+ }
270
273
  function normalize_date(date) {
271
- return date;
274
+ return expandYear(date);
272
275
  }
273
276
  function normalize_timestamp(time) {
274
- return `${time.replace(" ", "T")}+00:00`;
277
+ return expandYear(`${time.replace(" ", "T")}+00:00`);
275
278
  }
276
279
  function normalize_timestamptz(time) {
277
- return time.replace(" ", "T").replace(/[+-]\d{2}(:\d{2})?$/, "+00:00");
280
+ return expandYear(time.replace(" ", "T").replace(/[+-]\d{2}(:\d{2})?$/, "+00:00"));
278
281
  }
279
282
  function normalize_time(time) {
280
283
  return time;
@@ -289,13 +292,16 @@ function normalize_timez(time) {
289
292
  const pad = (n) => String(n).padStart(2, "0");
290
293
  return `${pad(Math.floor(seconds / 3600))}:${pad(Math.floor(seconds / 60) % 60)}:${pad(seconds % 60)}${fraction}`;
291
294
  }
295
+ var SUPPORTED_MONEY_FORMAT = /^(?:(-)[\p{L}\p{Sc}]+|[\p{L}\p{Sc}]+(-)?)(\d{1,3}(?:,\d{3})*)(\.(?!\d{3}$)\d+)?$/u;
292
296
  function normalize_money(money) {
293
- if (!/^-?\$\d{1,3}(,\d{3})*\.\d{2}$/.test(money)) {
297
+ const match = SUPPORTED_MONEY_FORMAT.exec(money);
298
+ if (match === null) {
294
299
  throw new Error(
295
- `Unsupported money format "${money}": only the default lc_monetary format, such as -$1,234.50, is supported`
300
+ `Unsupported money format "${money}": expected a currency symbol directly followed by an amount with "," thousands separators and a "." decimal point, such as -\xA31,234.50`
296
301
  );
297
302
  }
298
- return money.replace(/[^\d.-]/g, "");
303
+ const [, signBeforeSymbol = "", signAfterSymbol = "", integer, fraction = ""] = match;
304
+ return `${signBeforeSymbol}${signAfterSymbol}${integer.replaceAll(",", "")}${fraction}`;
299
305
  }
300
306
  function normalize_xml(xml) {
301
307
  return xml;
@@ -595,6 +601,13 @@ function isTlsError(error) {
595
601
  // src/pg.ts
596
602
  var types2 = pg2.types;
597
603
  var debug = Debug("prisma:driver-adapter:pg");
604
+ function isPgPoolLike(poolOrConfig) {
605
+ if (typeof poolOrConfig !== "object" || poolOrConfig === null) {
606
+ return false;
607
+ }
608
+ const candidate = poolOrConfig;
609
+ return typeof candidate.query === "function" && typeof candidate.connect === "function" && typeof candidate.end === "function" && typeof candidate.on === "function" && typeof candidate.removeListener === "function" && typeof candidate.options === "object" && candidate.options !== null;
610
+ }
598
611
  var PgQueryable = class {
599
612
  constructor(client, pgOptions) {
600
613
  this.client = client;
@@ -602,6 +615,14 @@ var PgQueryable = class {
602
615
  }
603
616
  provider = "postgres";
604
617
  adapterName = name;
618
+ // `pg.Client` and `pg.PoolClient` are single connections and don't support
619
+ // concurrent queries (deprecated in pg@8, an error in pg@9), so queries must
620
+ // be serialized. `pg.Pool` handles concurrency itself and must not be
621
+ // serialized, or the whole pool would be limited to one query at a time.
622
+ serializeQueries = true;
623
+ // Resolve-only lock: it tracks completion of the previous query and can
624
+ // never carry its error, so a failed query rejects only its own caller.
625
+ #queryLock = Promise.resolve();
605
626
  /**
606
627
  * Execute a query given as SQL, interpolating the given parameters.
607
628
  */
@@ -655,6 +676,20 @@ var PgQueryable = class {
655
676
  * marked as unhealthy.
656
677
  */
657
678
  async performIO(query) {
679
+ if (!this.serializeQueries) {
680
+ return this.sendQuery(query);
681
+ }
682
+ const previous = this.#queryLock;
683
+ let release;
684
+ this.#queryLock = new Promise((resolve) => release = resolve);
685
+ await previous;
686
+ try {
687
+ return await this.sendQuery(query);
688
+ } finally {
689
+ release();
690
+ }
691
+ }
692
+ async sendQuery(query) {
658
693
  const { sql, args } = query;
659
694
  const values = args.map((arg, i) => mapArg(arg, query.argTypes[i]));
660
695
  try {
@@ -691,13 +726,9 @@ var PgTransaction = class extends PgQueryable {
691
726
  }
692
727
  closed = false;
693
728
  runningStatements = 0;
729
+ #releaseError;
694
730
  async performIO(query) {
695
- if (this.closed) {
696
- throw new DriverAdapterError({
697
- kind: "TransactionAlreadyClosed",
698
- cause: "The transaction has already been committed or rolled back"
699
- });
700
- }
731
+ this.assertOpen();
701
732
  this.runningStatements++;
702
733
  try {
703
734
  return await super.performIO(query);
@@ -705,6 +736,18 @@ var PgTransaction = class extends PgQueryable {
705
736
  this.runningStatements--;
706
737
  }
707
738
  }
739
+ async sendQuery(query) {
740
+ this.assertOpen();
741
+ return super.sendQuery(query);
742
+ }
743
+ assertOpen() {
744
+ if (this.closed) {
745
+ throw new DriverAdapterError({
746
+ kind: "TransactionAlreadyClosed",
747
+ cause: "The transaction has already been committed or rolled back"
748
+ });
749
+ }
750
+ }
708
751
  /**
709
752
  * Closes the transaction at most once. Once the pool has lent the client to
710
753
  * a new owner, a second `release()` would corrupt the pool's bookkeeping, so
@@ -722,7 +765,7 @@ var PgTransaction = class extends PgQueryable {
722
765
  if (this.runningStatements > 0) {
723
766
  this.client.release(new Error("Transaction closed with a statement still running"));
724
767
  } else {
725
- this.client.release();
768
+ this.client.release(this.#releaseError);
726
769
  }
727
770
  }
728
771
  }
@@ -734,6 +777,12 @@ var PgTransaction = class extends PgQueryable {
734
777
  debug(`[js::rollback]`);
735
778
  this.close();
736
779
  }
780
+ onError(error) {
781
+ if (this.#releaseError === void 0 && !isDriverError(error)) {
782
+ this.#releaseError = error instanceof Error ? error : new Error(String(error));
783
+ }
784
+ super.onError(error);
785
+ }
737
786
  async createSavepoint(name2) {
738
787
  await this.executeRaw({ sql: `SAVEPOINT ${name2}`, args: [], argTypes: [] });
739
788
  }
@@ -750,6 +799,7 @@ var PrismaPgAdapter = class extends PgQueryable {
750
799
  this.pgOptions = pgOptions;
751
800
  this.release = release;
752
801
  }
802
+ serializeQueries = false;
753
803
  async startTransaction(isolationLevel) {
754
804
  const options = {
755
805
  usePhantomQuery: false
@@ -808,7 +858,7 @@ var PrismaPgAdapter = class extends PgQueryable {
808
858
  var PrismaPgAdapterFactory = class {
809
859
  constructor(poolOrConfig, options) {
810
860
  this.options = options;
811
- if (poolOrConfig instanceof pg2.Pool) {
861
+ if (isPgPoolLike(poolOrConfig)) {
812
862
  this.externalPool = poolOrConfig;
813
863
  this.config = poolOrConfig.options;
814
864
  } else if (typeof poolOrConfig === "string") {
@@ -824,12 +874,7 @@ var PrismaPgAdapterFactory = class {
824
874
  config;
825
875
  externalPool;
826
876
  async connect() {
827
- const client = this.externalPool ?? new pg2.Pool(withSearchPath(this.config, this.options?.schema));
828
- if (this.externalPool !== null && this.options?.schema !== void 0) {
829
- debug(
830
- `The search path is not set on externally provided pools, schema "${this.options.schema}" is only used for generated queries. Set the search path on the pool itself if raw queries need it.`
831
- );
832
- }
877
+ const client = this.externalPool ?? new pg2.Pool(this.config);
833
878
  const onIdleClientError = (err) => {
834
879
  debug(`Error from idle pool client: ${err.message} %O`, err);
835
880
  this.options?.onPoolError?.(err);
@@ -859,28 +904,6 @@ var PrismaPgAdapterFactory = class {
859
904
  });
860
905
  }
861
906
  };
862
- function withSearchPath(config, schema) {
863
- if (schema === void 0 || setsSearchPath(config.options)) {
864
- return config;
865
- }
866
- const searchPath = `-c search_path=${escapeOptionValue(quoteIdentifierIfNeeded(schema))},public`;
867
- return {
868
- ...config,
869
- options: config.options ? `${config.options} ${searchPath}` : searchPath
870
- };
871
- }
872
- function setsSearchPath(options) {
873
- return options !== void 0 && /(?:^|\s)(?:-c\s*|--)search[_-]path=/i.test(options);
874
- }
875
- function quoteIdentifierIfNeeded(name2) {
876
- if (/^[a-z_][a-z0-9_$]*$/.test(name2)) {
877
- return name2;
878
- }
879
- return `"${name2.replaceAll('"', '""')}"`;
880
- }
881
- function escapeOptionValue(value) {
882
- return value.replace(/[\\\s]/g, (char) => `\\${char}`);
883
- }
884
907
  export {
885
908
  PrismaPgAdapterFactory as PrismaPg
886
909
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/adapter-pg",
3
- "version": "7.11.0-dev.1",
3
+ "version": "7.11.0-dev.11",
4
4
  "description": "Prisma's driver adapter for \"pg\"",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -34,10 +34,10 @@
34
34
  "pg": "^8.16.3",
35
35
  "postgres-array": "3.0.4",
36
36
  "@types/pg": "^8.16.0",
37
- "@prisma/driver-adapter-utils": "7.11.0-dev.1"
37
+ "@prisma/driver-adapter-utils": "7.11.0-dev.11"
38
38
  },
39
39
  "devDependencies": {
40
- "@prisma/debug": "7.11.0-dev.1"
40
+ "@prisma/debug": "7.11.0-dev.11"
41
41
  },
42
42
  "scripts": {
43
43
  "dev": "DEV=true tsx helpers/build.ts",