Skip to content

PgClient: add statementTimeout and queryTimeout options#6387

Draft
agcty wants to merge 1 commit into
Effect-TS:mainfrom
agcty:agent/pg-statement-query-timeout
Draft

PgClient: add statementTimeout and queryTimeout options#6387
agcty wants to merge 1 commit into
Effect-TS:mainfrom
agcty:agent/pg-statement-query-timeout

Conversation

@agcty

@agcty agcty commented Jul 14, 2026

Copy link
Copy Markdown

Migration

Replacement for Effect-TS/effect-smol#2617, opened after Effect V4 development moved back to this repository. Please refer to the original PR for its existing discussion and review history.

This is a direct migration of the original two-file change onto the current Effect-TS/effect:main branch.

Motivation

PgClientConfig exposes connectTimeout, but there is no way to bound statement execution: the pg driver statement_timeout (server-side cancel) and query_timeout (client-side) options are not passed through, so a hung or runaway statement waits indefinitely unless the caller rebuilds pool acquisition via fromPool.

This hardening gap affects Cloudflare Workers Durable Objects, where a wedged socket may otherwise only be recovered by the platform resetting the object.

Changes

  • Add statementTimeout and queryTimeout (Duration.Input) to PgClientConfig.
  • Wire them to pg as statement_timeout and query_timeout in both make (pool) and makeClient (single client).
  • Add a patch changeset for @effect/sql-pg.

Validation

  • pnpm lint-fix
  • pnpm check
  • pnpm test packages/sql/pg/test/Client.test.ts --run (23 tests passed)

@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Jul 14, 2026
@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 06b9f02

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
@effect/sql-pg Patch
effect Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 enhancement New feature or request

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

2 participants