Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fix-startup-error
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgleason committed Nov 18, 2024
2 parents 4e583e8 + a2c7de1 commit 39aa033
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ['12', '14', '16', '18', '20', '21']
postgres: ['12', '13', '14', '15', '16']
node: ['12', '14', '16', '18', '20', '21', '22']
postgres: ['12', '13', '14', '15', '16', '17']
runs-on: ubuntu-latest
services:
postgres:
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ for await (const chunk of readableStream) {
}
```

> **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.
> **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.
### Canceling Queries in Progress

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

| Option | Environment Variables |
| ----------------- | ------------------------ |
| `host` | `PGHOST` |
| `port` | `PGPORT` |
| `database` | `PGDATABASE` |
| `username` | `PGUSERNAME` or `PGUSER` |
| `password` | `PGPASSWORD` |
| `idle_timeout` | `PGIDLE_TIMEOUT` |
| `connect_timeout` | `PGCONNECT_TIMEOUT` |
| Option | Environment Variables |
| ------------------ | ------------------------ |
| `host` | `PGHOST` |
| `port` | `PGPORT` |
| `database` | `PGDATABASE` |
| `username` | `PGUSERNAME` or `PGUSER` |
| `password` | `PGPASSWORD` |
| `application_name` | `PGAPPNAME` |
| `idle_timeout` | `PGIDLE_TIMEOUT` |
| `connect_timeout` | `PGCONNECT_TIMEOUT` |

### Prepared statements

Expand Down
2 changes: 1 addition & 1 deletion cf/src/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
}

function queryError(query, err) {
Object.defineProperties(err, {
'query' in err || 'parameters' in err || Object.defineProperties(err, {
stack: { value: err.stack + query.origin.replace(/.*\n/, '\n'), enumerable: options.debug },
query: { value: query.string, enumerable: options.debug },
parameters: { value: query.parameters, enumerable: options.debug },
Expand Down
2 changes: 1 addition & 1 deletion cjs/src/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
}

function queryError(query, err) {
'parameters' in err || Object.defineProperties(err, {
'query' in err || 'parameters' in err || Object.defineProperties(err, {
stack: { value: err.stack + query.origin.replace(/.*\n/, '\n'), enumerable: options.debug },
query: { value: query.string, enumerable: options.debug },
parameters: { value: query.parameters, enumerable: options.debug },
Expand Down
2 changes: 1 addition & 1 deletion deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ for await (const chunk of readableStream) {
}
```

> **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.
> **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.
### Canceling Queries in Progress

Expand Down
2 changes: 1 addition & 1 deletion deno/src/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
}

function queryError(query, err) {
Object.defineProperties(err, {
'query' in err || 'parameters' in err || Object.defineProperties(err, {
stack: { value: err.stack + query.origin.replace(/.*\n/, '\n'), enumerable: options.debug },
query: { value: query.string, enumerable: options.debug },
parameters: { value: query.parameters, enumerable: options.debug },
Expand Down
2 changes: 1 addition & 1 deletion deno/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2583,4 +2583,4 @@ t('arrays in reserved connection', async() => {
]
})

;window.addEventListener("unload", () => Deno.exit(process.exitCode))
;globalThis.addEventListener("unload", () => Deno.exit(process.exitCode))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postgres",
"version": "3.4.4",
"version": "3.4.5",
"description": "Fastest full featured PostgreSQL client for Node.js",
"type": "module",
"module": "src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ function parseOptions(a, b) {
{}
),
connection : {
application_name: 'postgres.js',
application_name: env.PGAPPNAME || 'postgres.js',
...o.connection,
...Object.entries(query).reduce((acc, [k, v]) => (k in defaults || (acc[k] = v), acc), {})
},
Expand Down
2 changes: 1 addition & 1 deletion transpile.deno.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function transpile(x, name, folder) {
.replace('{ spawnSync }', '{ spawn }')
}
if (name === 'index.js')
x += '\n;window.addEventListener("unload", () => Deno.exit(process.exitCode))'
x += '\n;globalThis.addEventListener("unload", () => Deno.exit(process.exitCode))'
}

const buffer = x.includes('Buffer')
Expand Down

0 comments on commit 39aa033

Please sign in to comment.