Skip to content

Add DefaultPostgreSQLProviderFeatures with the 65535 placeholder limit - #257

Open
Chengxuan wants to merge 1 commit into
hyperledger-firefly:mainfrom
kaleido-io:postgres-default-features
Open

Chengxuan wants to merge 1 commit into
hyperledger-firefly:mainfrom
kaleido-io:postgres-default-features

Conversation

@Chengxuan

@Chengxuan Chengxuan commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

PostgreSQL caps a single statement at 65535 bind parameters. The limit comes from the wire protocol. InsertMany already chunks multi-row inserts when SQLFeatures.MaxPlaceholders is set, but every PostgreSQL provider has to remember to set it.

This adds, next to BuildPostgreSQLOptimizedUpsert:

  • PostgreSQLMaxPlaceholders = 65535
  • DefaultPostgreSQLProviderFeatures(), returning DefaultSQLProviderFeatures() with $N placeholders, multi-row insert, MaxPlaceholders and the PostgreSQL optimized upsert builder set

Providers can start from it and add their own features on top (lock SQL, ILIKE, sequence column filtering), for example:

func (psql *Postgres) Features() dbsql.SQLFeatures {
	features := dbsql.DefaultPostgreSQLProviderFeatures()
	features.AcquireLock = func(lockName string) string { ... }
	return features
}

No behavior changes for existing callers.

…imit

Signed-off-by: Chengxuan Xing <chengxuan.xing@kaleido.io>
@Chengxuan
Chengxuan requested a review from a team as a code owner October 2, 2026 12:08

@onelapahead onelapahead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me, but might defer to @awrichar on the specific features being proposed as defaults

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants