diff --git a/.changeset/swift-news-move.md b/.changeset/swift-news-move.md new file mode 100644 index 00000000..38d75330 --- /dev/null +++ b/.changeset/swift-news-move.md @@ -0,0 +1,5 @@ +--- +'@electric-sql/pglite': patch +--- + +Fix a bug with pipelining prepared statements. diff --git a/packages/pglite/tests/exec-protocol.test.ts b/packages/pglite/tests/exec-protocol.test.ts index 95be8916..bee15660 100644 --- a/packages/pglite/tests/exec-protocol.test.ts +++ b/packages/pglite/tests/exec-protocol.test.ts @@ -27,19 +27,23 @@ describe('exec protocol', () => { it('should perform an extended query', async () => { const r1 = await db.execProtocol(serialize.parse({ text: 'SELECT $1' })) const messageNames1 = r1.messages.map((msg) => msg.name) - expect(messageNames1).toEqual(['notice', 'parseComplete']) + expect(messageNames1).toEqual(['notice', 'parseComplete', 'readyForQuery']) const r2 = await db.execProtocol(serialize.bind({ values: ['1'] })) const messageNames2 = r2.messages.map((msg) => msg.name) - expect(messageNames2).toEqual(['notice', 'bindComplete']) + expect(messageNames2).toEqual(['notice', 'bindComplete', 'readyForQuery']) const r3 = await db.execProtocol(serialize.describe({ type: 'P' })) const messageNames3 = r3.messages.map((msg) => msg.name) - expect(messageNames3).toEqual(['rowDescription']) + expect(messageNames3).toEqual(['rowDescription', 'readyForQuery']) const r4 = await db.execProtocol(serialize.execute({})) const messageNames4 = r4.messages.map((msg) => msg.name) - expect(messageNames4).toEqual(['dataRow', 'commandComplete']) + expect(messageNames4).toEqual([ + 'dataRow', + 'commandComplete', + 'readyForQuery', + ]) const r5 = await db.execProtocol(serialize.sync()) const messageNames5 = r5.messages.map((msg) => msg.name) diff --git a/patches/interactive_one.c b/patches/interactive_one.c index 64eef178..9a1a2043 100644 --- a/patches/interactive_one.c +++ b/patches/interactive_one.c @@ -143,16 +143,6 @@ static void io_init(bool in_auth, bool out_auth) { } -/* -static void wait_unlock() { - int busy = 0; - while (access(PGS_OLOCK, F_OK) == 0) { - if (!(busy++ % 1110222)) - printf("# 150: FIXME: busy wait lock removed %d\n", busy); - } -} -*/ - EMSCRIPTEN_KEEPALIVE int cma_wsize = 0; @@ -637,4 +627,3 @@ printf("# 353 : node+repl is_wire/is_socket -> true : %c\n", firstchar); } -