Skip to content

Commit 39aa033

Browse files
committed
Merge remote-tracking branch 'upstream/master' into fix-startup-error
2 parents 4e583e8 + a2c7de1 commit 39aa033

File tree

10 files changed

+21
-20
lines changed

10 files changed

+21
-20
lines changed

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
node: ['12', '14', '16', '18', '20', '21']
12-
postgres: ['12', '13', '14', '15', '16']
11+
node: ['12', '14', '16', '18', '20', '21', '22']
12+
postgres: ['12', '13', '14', '15', '16', '17']
1313
runs-on: ubuntu-latest
1414
services:
1515
postgres:

README.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ for await (const chunk of readableStream) {
537537
}
538538
```
539539

540-
> **NOTE** This is a low-level API which does not provide any type safety. To make this work, you must match your [`copy query` parameters](https://www.postgresql.org/docs/14/sql-copy.html) correctly to your [Node.js stream read or write](https://nodejs.org/api/stream.html) code. Ensure [Node.js stream backpressure](https://nodejs.org/en/docs/guides/backpressuring-in-streams/) is handled correctly to avoid memory exhaustion.
540+
> **NOTE** This is a low-level API which does not provide any type safety. To make this work, you must match your [`copy query` parameters](https://www.postgresql.org/docs/14/sql-copy.html) correctly to your [Node.js stream read or write](https://nodejs.org/api/stream.html) code. Ensure [Node.js stream backpressure](https://nodejs.org/en/learn/modules/backpressuring-in-streams) is handled correctly to avoid memory exhaustion.
541541
542542
### Canceling Queries in Progress
543543

@@ -1125,15 +1125,16 @@ It is also possible to connect to the database without a connection string or an
11251125
const sql = postgres()
11261126
```
11271127

1128-
| Option | Environment Variables |
1129-
| ----------------- | ------------------------ |
1130-
| `host` | `PGHOST` |
1131-
| `port` | `PGPORT` |
1132-
| `database` | `PGDATABASE` |
1133-
| `username` | `PGUSERNAME` or `PGUSER` |
1134-
| `password` | `PGPASSWORD` |
1135-
| `idle_timeout` | `PGIDLE_TIMEOUT` |
1136-
| `connect_timeout` | `PGCONNECT_TIMEOUT` |
1128+
| Option | Environment Variables |
1129+
| ------------------ | ------------------------ |
1130+
| `host` | `PGHOST` |
1131+
| `port` | `PGPORT` |
1132+
| `database` | `PGDATABASE` |
1133+
| `username` | `PGUSERNAME` or `PGUSER` |
1134+
| `password` | `PGPASSWORD` |
1135+
| `application_name` | `PGAPPNAME` |
1136+
| `idle_timeout` | `PGIDLE_TIMEOUT` |
1137+
| `connect_timeout` | `PGCONNECT_TIMEOUT` |
11371138

11381139
### Prepared statements
11391140

cf/src/connection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
387387
}
388388

389389
function queryError(query, err) {
390-
Object.defineProperties(err, {
390+
'query' in err || 'parameters' in err || Object.defineProperties(err, {
391391
stack: { value: err.stack + query.origin.replace(/.*\n/, '\n'), enumerable: options.debug },
392392
query: { value: query.string, enumerable: options.debug },
393393
parameters: { value: query.parameters, enumerable: options.debug },

cjs/src/connection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
385385
}
386386

387387
function queryError(query, err) {
388-
'parameters' in err || Object.defineProperties(err, {
388+
'query' in err || 'parameters' in err || Object.defineProperties(err, {
389389
stack: { value: err.stack + query.origin.replace(/.*\n/, '\n'), enumerable: options.debug },
390390
query: { value: query.string, enumerable: options.debug },
391391
parameters: { value: query.parameters, enumerable: options.debug },

deno/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ for await (const chunk of readableStream) {
533533
}
534534
```
535535

536-
> **NOTE** This is a low-level API which does not provide any type safety. To make this work, you must match your [`copy query` parameters](https://www.postgresql.org/docs/14/sql-copy.html) correctly to your [Node.js stream read or write](https://nodejs.org/api/stream.html) code. Ensure [Node.js stream backpressure](https://nodejs.org/en/docs/guides/backpressuring-in-streams/) is handled correctly to avoid memory exhaustion.
536+
> **NOTE** This is a low-level API which does not provide any type safety. To make this work, you must match your [`copy query` parameters](https://www.postgresql.org/docs/14/sql-copy.html) correctly to your [Node.js stream read or write](https://nodejs.org/api/stream.html) code. Ensure [Node.js stream backpressure](https://nodejs.org/en/learn/modules/backpressuring-in-streams) is handled correctly to avoid memory exhaustion.
537537
538538
### Canceling Queries in Progress
539539

deno/src/connection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
388388
}
389389

390390
function queryError(query, err) {
391-
Object.defineProperties(err, {
391+
'query' in err || 'parameters' in err || Object.defineProperties(err, {
392392
stack: { value: err.stack + query.origin.replace(/.*\n/, '\n'), enumerable: options.debug },
393393
query: { value: query.string, enumerable: options.debug },
394394
parameters: { value: query.parameters, enumerable: options.debug },

deno/tests/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2583,4 +2583,4 @@ t('arrays in reserved connection', async() => {
25832583
]
25842584
})
25852585

2586-
;window.addEventListener("unload", () => Deno.exit(process.exitCode))
2586+
;globalThis.addEventListener("unload", () => Deno.exit(process.exitCode))

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postgres",
3-
"version": "3.4.4",
3+
"version": "3.4.5",
44
"description": "Fastest full featured PostgreSQL client for Node.js",
55
"type": "module",
66
"module": "src/index.js",

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ function parseOptions(a, b) {
480480
{}
481481
),
482482
connection : {
483-
application_name: 'postgres.js',
483+
application_name: env.PGAPPNAME || 'postgres.js',
484484
...o.connection,
485485
...Object.entries(query).reduce((acc, [k, v]) => (k in defaults || (acc[k] = v), acc), {})
486486
},

transpile.deno.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function transpile(x, name, folder) {
5555
.replace('{ spawnSync }', '{ spawn }')
5656
}
5757
if (name === 'index.js')
58-
x += '\n;window.addEventListener("unload", () => Deno.exit(process.exitCode))'
58+
x += '\n;globalThis.addEventListener("unload", () => Deno.exit(process.exitCode))'
5959
}
6060

6161
const buffer = x.includes('Buffer')

0 commit comments

Comments
 (0)