postgres icon indicating copy to clipboard operation
postgres copied to clipboard

Trying to reserve a connection without previously executing any sql hangs indefinitely.

Open mikeburgh opened this issue 2 years ago • 1 comments

This does not happen unless fetch_types is set to false which means no connections are attempted before the reserve. If you leave fetch_types alone, or perform another sql opteration first, it works.

Using the latest version:

const postgres = require('postgres');

async function main() {
	const sql = postgres({
		host: '127.0.0.1',
		port: 5432,
		user: 'postgres',
		password: 'postgres',
		database: 'postgres',
		fetch_types: false
	});

	console.log('Starting');
	const reserved = await sql.reserve();
	console.log(await reserved`select 1`);
	console.log('done');
	reserved.release();
}

main();

mikeburgh avatar Dec 05 '23 23:12 mikeburgh

Related: https://github.com/porsager/postgres/commit/c084a1cf0ffd5aeaf9388ef0c84d0da28fca24b5#r131741037

tim-smart avatar Feb 01 '24 02:02 tim-smart