porsager / porsager/postgres

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

Open
#751 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
8.7k
Forks
374
Avg merge
11d 16h
Merged PRs (30d)
1

Description

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();

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied JavaScript reproduction, focusing on sql.reserve(), fetch_types: false, and the reserved tagged select query. Confirm the hang before changing anything, then trace the reserve path and add or run a regression check showing that reservation resolves, select 1 returns, and reserved.release() completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, postgres
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.