postgres
postgres copied to clipboard
Trying to reserve a connection without previously executing any sql hangs indefinitely.
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();
Related: https://github.com/porsager/postgres/commit/c084a1cf0ffd5aeaf9388ef0c84d0da28fca24b5#r131741037