From 774bd9666c2436b3b6eb2df0554b4964fd06108d Mon Sep 17 00:00:00 2001 From: Greg Richardson Date: Wed, 11 Sep 2024 18:27:39 -0600 Subject: [PATCH 1/3] feat: add test to detect pglite hang after error --- packages/pg-gateway/test/node/pg.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/pg-gateway/test/node/pg.test.ts b/packages/pg-gateway/test/node/pg.test.ts index f89fedd..a0be584 100644 --- a/packages/pg-gateway/test/node/pg.test.ts +++ b/packages/pg-gateway/test/node/pg.test.ts @@ -47,4 +47,15 @@ describe('pg client with pglite', () => { const [{ message }] = res.rows; expect(message).toBe('Hello world!'); }); + + it('invalid sql throws an error but does not hang', async () => { + await using client = await connect(); + const promise = client.query('invalid sql'); + await expect(promise).rejects.toThrowError('syntax error at or near "invalid"'); + + // Run another query to see if the connection hung + const res = await client.query("select 'Hello world!' as message"); + const [{ message }] = res.rows; + expect(message).toBe('Hello world!'); + }); }); From 1efb9303d9e59acbf636dcacbf3f0ee806976826 Mon Sep 17 00:00:00 2001 From: Greg Richardson Date: Fri, 13 Sep 2024 16:05:54 -0600 Subject: [PATCH 2/3] chore: upgrade all versions of pglite --- examples/pglite-auth/package.json | 2 +- examples/pglite-multiple/package.json | 2 +- package-lock.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/pglite-auth/package.json b/examples/pglite-auth/package.json index 7a7fe41..d4ea516 100644 --- a/examples/pglite-auth/package.json +++ b/examples/pglite-auth/package.json @@ -7,7 +7,7 @@ "type-check": "tsc --noEmit" }, "dependencies": { - "@electric-sql/pglite": "^0.2.6", + "@electric-sql/pglite": "^0.2.7", "pg-gateway": "*" }, "devDependencies": { diff --git a/examples/pglite-multiple/package.json b/examples/pglite-multiple/package.json index 846936a..90c18d1 100644 --- a/examples/pglite-multiple/package.json +++ b/examples/pglite-multiple/package.json @@ -8,7 +8,7 @@ "type-check": "tsc --noEmit" }, "dependencies": { - "@electric-sql/pglite": "^0.2.6", + "@electric-sql/pglite": "^0.2.7", "pg-gateway": "*" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index 9997dd7..d5ec16a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "examples/pglite-auth": { "name": "pglite-auth-example", "dependencies": { - "@electric-sql/pglite": "^0.2.6", + "@electric-sql/pglite": "^0.2.7", "pg-gateway": "*" }, "devDependencies": { @@ -26,7 +26,7 @@ "examples/pglite-multiple": { "name": "pglite-multiple-example", "dependencies": { - "@electric-sql/pglite": "^0.2.6", + "@electric-sql/pglite": "^0.2.7", "pg-gateway": "*" }, "devDependencies": { From 87f2096b18b41f7e5554ee22f7d2b4da1b4306ef Mon Sep 17 00:00:00 2001 From: Greg Richardson Date: Fri, 13 Sep 2024 16:33:11 -0600 Subject: [PATCH 3/3] chore: update pglite version in deno.lock --- deno.lock | 13 ++++++------- packages/pg-gateway/test/deno/tcp.test.ts | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/deno.lock b/deno.lock index e795e93..1a90584 100644 --- a/deno.lock +++ b/deno.lock @@ -8,8 +8,7 @@ "jsr:@std/testing": "jsr:@std/testing@1.0.1", "npm:@biomejs/biome@1.8.3": "npm:@biomejs/biome@1.8.3", "npm:@biomejs/biome@^1.8.3": "npm:@biomejs/biome@1.8.3", - "npm:@electric-sql/pglite": "npm:@electric-sql/pglite@0.2.6", - "npm:@electric-sql/pglite@^0.2.6": "npm:@electric-sql/pglite@0.2.6", + "npm:@electric-sql/pglite@^0.2.7": "npm:@electric-sql/pglite@0.2.7", "npm:@jsr/std__bytes@^1.0.2": "npm:@jsr/std__bytes@1.0.2", "npm:@jsr/std__crypto@^1.0.3": "npm:@jsr/std__crypto@1.0.3", "npm:@jsr/std__encoding@^1.0.3": "npm:@jsr/std__encoding@1.0.3", @@ -153,8 +152,8 @@ "tough-cookie": "tough-cookie@4.1.4" } }, - "@electric-sql/pglite@0.2.6": { - "integrity": "sha512-tyWWxj1Z1Pd4BqBZL1ER2SXaCn5s9N0bxTQCAkGaaWe8r9EEe1bNs20RAG3/+ZeBJtDrk8y5xjocactL+4aIXg==", + "@electric-sql/pglite@0.2.7": { + "integrity": "sha512-8Il//XHTAtZ8VeQF+6P1UjsIoaAJyO4LwOMoXhSFaHpmkwKs63cUhHHNzLzUmcZvP/ZTmlT3+xTiWfU/EyoxwQ==", "dependencies": {} }, "@esbuild/aix-ppc64@0.21.5": { @@ -2056,7 +2055,7 @@ "packageJson": { "dependencies": [ "npm:@biomejs/biome@1.8.3", - "npm:@electric-sql/pglite@^0.2.6", + "npm:@electric-sql/pglite@^0.2.7", "npm:@total-typescript/tsconfig@^1.0.4", "npm:@types/node@^20.14.11", "npm:pg-gateway", @@ -2069,7 +2068,7 @@ "packageJson": { "dependencies": [ "npm:@biomejs/biome@1.8.3", - "npm:@electric-sql/pglite@^0.2.6", + "npm:@electric-sql/pglite@^0.2.7", "npm:@total-typescript/tsconfig@^1.0.4", "npm:@types/node@^20.14.11", "npm:pg-gateway", @@ -2094,7 +2093,7 @@ "packageJson": { "dependencies": [ "npm:@biomejs/biome@^1.8.3", - "npm:@electric-sql/pglite@^0.2.6", + "npm:@electric-sql/pglite@^0.2.7", "npm:@jsr/std__bytes@^1.0.2", "npm:@jsr/std__crypto@^1.0.3", "npm:@jsr/std__encoding@^1.0.3", diff --git a/packages/pg-gateway/test/deno/tcp.test.ts b/packages/pg-gateway/test/deno/tcp.test.ts index 35c2e07..030d33e 100644 --- a/packages/pg-gateway/test/deno/tcp.test.ts +++ b/packages/pg-gateway/test/deno/tcp.test.ts @@ -3,7 +3,7 @@ import pg from 'npm:pg'; import { expect } from 'jsr:@std/expect'; import { afterAll, beforeAll, describe, it } from 'jsr:@std/testing/bdd'; -import { PGlite } from 'npm:@electric-sql/pglite'; +import { PGlite } from 'npm:@electric-sql/pglite@^0.2.7'; import { fromDenoConn } from 'pg-gateway/deno'; const { Client } = pg;