NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev · #590 most downloaded on pub.dev
PostgreSQL database driver. Supports binary protocol, connection pooling and statement reuse.
Last release today
07 Oct 2026
Release timing varies
gaps range from 2 weeks to 7 months
Nearly every release is documented
notes for 59 of the last 60 stable releases
1 version withdrawn
withdrawn after publishing
10 years old
93 releases · first in 2016
Fix the package no longer compiling to JavaScript (a 3.5.18 regression).
Add SessionSettings.ignoreStackTraces to skip StackTrace.current capture on statement execution.
SessionSettings.ignoreStackTraces to skip StackTrace.current capture on statement execution.List<Object?> instead of a list of their element type (a 3.5.18 regression).numeric values in linear time instead of quadratic for high-precision numbers.One column per quarter.
Fix the statement after a failed one sometimes returning no rows.
timestamp/timestamptz/date infinity/-infinity decoding: threw, or (binary date) silently returned the wrong finite date, instead of degrading gracefully.Channels[channel] listener hanging forever instead of erroring when the in-flight LISTEN it joined fails; fix a related crash in unsubscribe.runTx leaving _activeTransaction set forever if neither COMMIT nor ROLLBACK ran.Fix runTx throwing instead of waiting when called while another transaction is active on the same connection. Only a call from within the transaction'
runTx throwing instead of waiting when called while another transaction is active on the same connection. Only a call from within the transaction's own callback fails fast now.Fix DateRange truncating pre-1970 bounds with a time component to the wrong day.
DateRange truncating pre-1970 bounds with a time component to the wrong day.close() was already called, and Statement.dispose() throwing if called twice.runTx deadlocking instead of failing fast when called again from within its own callback, and an SSL handshake that times out but succeeds later leaking its socket.SCRAM-SHA-256.< 4 crashing the parser instead of failing gracefully, and remove a broken, unused bytesToMessageParser.tsvector/tsquery throwing instead of degrading gracefully when decoded in text format.TypeOid constants instead of raw literals in binary array encoders.Fix the hard-timeout fallback deadlocking the connection.
Sql.indexed operator-tokenizing bug silently dropping the :type annotation.port query parameter being ignored for comma-separated hosts in connection strings.null elements, and range decoding crashing on an unrecognized flag byte instead of failing gracefully.RelationMessage.typeModifier and FieldDescription.typeSize decoding as unsigned instead of signed, and TruncateMessage (now .options) being unable to represent combined CASCADE/RESTART IDENTITY flags.$body$...$body$) not being recognized in Sql.indexed queries.runTx discarding the original exception when the rollback it triggers also fails, and add timeouts to the internal commit/rollback and to cancelPendingStatement() so a hung server can't deadlock the connection.Pool.close() potentially missing a connection that was still being created, the pool's connectTimeout budget being applied twice, Pool.prepare() keeping a broken connection in circulation after a failure, and per-call onOpen closures silently defeating connection reuse.DateTime.parse doesn't understand Postgres's BC suffix).DateTime elements (e.g. an untyped List<DateTime> bind parameter), throwing Could not infer array type instead of encoding a Postgres array literal.Pool.close() potentially returning before a connect attempt that timed out (but was still resolving in the background) had actually finished closing.Remove an unconditional print() warning for the deprecated read type-substitution alias.
Bad state: StreamSink is closed crash when the socket closes in the narrow window between connecting and sending the first message (e.g. StartupMessage, a bound statement, or a simple query); this now surfaces as a catchable PgException.connect() leaking the socket and its listener when startup (or onOpen) fails instead of closing the partially-opened connection.connect() failures (e.g. wrong password, SSL/auth errors) reporting a stack trace made up of internal frames only; the caller's stack is now attached so the trace points back to the code that called connect()/Connection.open().LISTEN (Channels[channel]): the trace now points back to the code that subscribed to the channel.UNLISTEN (sent when the last listener on a channel cancels) throwing when it raced a concurrent close(); this is now treated as a no-op instead of failing whatever cancelled the subscription.Sync-terminated exchange, so a transaction-mode pooler could hand the connection to another client between the parse and the bind (26000/42P05). Parse, bind and execute now travel in one exchange under the unnamed statement.Close for the unnamed statement it never named; failure and success now cost the same single exchange.port connection-string query parameter being ignored whenever a host was already present in the URI (e.g. postgresql://host/db?port=9876).typeRegistry or securityContext settings.Channels.notify() permanently failing after one transient error; a failed attempt to prepare the notify statement is no longer cached.PgException.print() warning for the deprecated read type-substitution alias.DateTime on every call.typeOid always null; the live decode path now resolves types and decodes binary columns.TypeRegistry.decode() now returns FutureOr<Object?> instead of Future<Object?>, avoiding a Future allocation per column for the common synchronous codec case; this removes real overhead from the row-decoding hot path.connectTimeout/queryTimeout: Duration.zero (or negative) meaning "wait forever" instead of failing fast; such values are now rejected at settings construction, matching the connection-string parser's existing validation.PgException instead of silently authenticating with an empty one; also fixes a pending-operation error (e.g. this one) escaping as an unhandled exception instead of a catchable connection failure.Fix socket/listener leaks in cancelAll() and cancelPendingStatement(), and add a hard timeout fallback so a stuck query can't hang forever even if can
cancelAll() and cancelPendingStatement(), and add a hard timeout fallback so a stuck query can't hang forever even if cancellation fails.Pool.prepare() hanging when a connection can't be acquired, Pool.close() returning before in-use connections finish closing, and pooled connects ignoring time already spent waiting for a slot.securityContext from pool-level settings.sslmode=prefer/allow and replication=on/off/yes/no/1/0 values.TypedValue(Type.unspecified, ...) silently discarding a parameter type known from a :type annotation or prepared statement.Sql.indexed mis-tokenizing the @>, <@, @?, @@ operators as auto-incrementing variables.Severity parsing to prefer PostgreSQL's non-localized error-severity field.DatabaseInfo column lookup causing a RangeError instead of returning null.LSN.operator- performing addition instead of subtraction.Range.flag misclassifying a valid single-point inclusive range (e.g. [x,x]) as empty.numeric Infinity/-Infinity values silently decoding as 0.Fix runTx silently rolling back after ROLLBACK TO SAVEPOINT recovery: clear stale _transactionException when PostgreSQL confirms a healthy transaction
runTx silently rolling back after ROLLBACK TO SAVEPOINT recovery: clear stale _transactionException when PostgreSQL confirms a healthy transaction state.BEGIN fails inside runTx (stale _activeTransaction state).ROLLBACK fails after a transaction error.Uint8List parameters being encoded as an integer array literal: they are now encoded as a bytea hex literal.Adding JsonbListView with isSqlNull(int index) method to check if a JSONB array has SQL or JSON null value.
JsonbListView with isSqlNull(int index) method to check if a JSONB array has SQL or JSON null value.Supporting BYTEA[] built-in type.
BYTEA[] built-in type.Supporting multiple hosts in connection strings via comma-separated hosts or multiple host query parameters.
host query parameters.host query parameter (automatically detected when path contains /).user/username, password, database, and port as query parameters in connection strings (override URL components).Upgraded SDK constraints and lints.
Supporting URL-based connection-string specification in Connection.openFromUrl and Pool.withUrl. (Note: feature and supported settings is considered e
Connection.openFromUrl and Pool.withUrl. (Note: feature and supported settings is considered experimental.)Accept null values as part of the binary List encodings.
null values as part of the binary List encodings.Better exception message when SSL is not supported.
read -> real, also keeping read for compatibility).Warning: This version fixes the inconsistency of 3.5.3 by:
Warning: This version fixes the inconsistency of 3.5.3 by:
UniqueViolationException and ForeignKeyViolationException extends ServerException instead of PgException, andServerException instead of PgException.New typed exceptions: UniqueViolationException, ForeignKeyViolationException. #416 by hurrba
UniqueViolationException, ForeignKeyViolationException. #416 by hurrbaFix: Pool connection timeout does not rely on package:pool's timeout, instead uses a separate Timer.
Pool connection timeout does not rely on package:pool's timeout, instead uses a separate Timer.Fix: ARRAY_AGG (and other arrays) may return [null].
ARRAY_AGG (and other arrays) may return [null].Better exception stacktraces (in some cases) using package:stack_trace.
package:stack_trace.3.4.Fix: Don't ignore de pool resource close call when using foce. #406 by davidmartos96.
close call when using foce. #406 by davidmartos96.Implemented Pool.close(force: true) (using davidmartos96's #397 as baseline).
Pool.close(force: true) (using davidmartos96's #397 as baseline).Fix: do not close connection after an empty statement.
close(force: true) does not cause uncaught exception.close(force: true) to indicate intent to force-close pending queries and resources. #396 by davidmartos96
close(force: true) to indicate intent to force-close pending queries and resources. #396 by davidmartos96disabled.Fix: explicit closing of prepared statement portals in transactions to release table locks. #393
Fix: prevent hanging state by forwarding protocol-level parsing errors into the message stream.
Fix: When a transaction is rolled back, do not expose the exception on rollback, rather the original exception from the transaction.
Do not allow exceptions escape when closing broken connection. #384 by pulyaevskiy.
Deprecated TupleDataColumn.data, use .value instead (for binary protocol messages).
Connection.info (through ConnectionInfo class) exposes read-only connection-level information,
e.g. acessing access server-provided parameter status values.pgoutput replication by wolframm.Codec interface is used for encoding/decoding value by type OIDs or Dart values.Codec.encode and Codec.decode gets a reference to CodecContext which provides
access to encoding, observed runtime parameters and the TypeRegistry.EncoderFn value converter for generic Dart object -> Postgres-encoded bytes
(for values where type is not specified).DatabaseInfo tracks information about relations and oids (currently limited to RelationMessage caching).runTx callback will throw an exception.timeout will try to actively cancel the current statement using a new connection.ServerException may be transformed into _PgQueryCancelledException which is both PgException and TimeoutException (but no longer ServerException).TupleDataColumn.data, use .value instead (for binary protocol messages).@internal-annotated methods from the public API of ServerException and Severity.Nothing published for this version
Nothing published for this version
Removed legacy v2 APIs. These APIs were meant to be removed in 3.1.0, but were kept for a bit longer, as they didn't have any drawback to be around. H
Removed legacy v2 APIs. These APIs were meant to be removed in 3.1.0, but
were kept for a bit longer, as they didn't have any drawback to be around.
However, a planned redesign of the type customization would require to touch the
v2 codebase and it is not worth the effort to keep it much longer.
Added or fixed decoders support for QueryMode.simple: double, real, timestampWithTimezone, timestampWithoutTimezone, date, numeric, json, jsonb #338 b
Support for tsvector and tsquery types.
tsvector and tsquery types.ResultRow.isSqlNull(int) returns true if the column's value was SQL NULL.TypedValue.isSqlNull indicates SQL NULL (vs. JSON null).ConnectionSettings.onOpen callback to initialize a new connection and set connection-level variables.
ConnectionSettings.onOpen callback to initialize a new connection and set
connection-level variables.Use ':' (colon) for substitution and cast operator together #309 by xvrh.
Added the following PostgreSQL builtin types:
Properly react to connection losses by reporting the database connection as closed.
Allow cleartext passwords when secure connection is used. (#283 by simolus3)
Allow passing a SecurityContext when opening postgres connections.
SecurityContext when opening postgres connections.Support for type char/character/bpchar.
char/character/bpchar.Fix: SSL connection problem handler.
Using const for ConnectionSettings, SessionSettings and PoolSettings classes. (#267 by Gerrel)
Deprecated ParseMessage constructor's types argument, use typeOids instead. (As most users don't access this directly, it will be removed in 3.1.0).
Deprecated all of v2 API, legacy fallback will be removed in next minor version (3.1.0).
execute after closing the Connection.Session.runTx() supports rolling back the transaction through TxSession.rollback()
(otherwise any exception has the same effect, but callers need to catch it).serial4, serial8, integer...3.1.0).New API (better names and consistency).
New features:
3.1.0).The package had a partial rewrite affecting public client API and internal behaviour, keeping most of the wire protocol handling from the old version.
Users of this package must rewrite and test their application when upgrading.
Notable breaking behaviour changes:
mappedResultsQuery to be
removed from the new API.interval values are returned as Interval type instead of Duration.UndecodedBytes instances are returned when the package does
not know or has not implemented the appropriate type decoding yet.
Previously these values were auto-encoded to String and if that failed
the Uint8List were used.package:postgres/legacy.dart provides a somewhat backwards-compatible API
via the PostgreSQLConnection.withV3() constructor. Many features, including
the ones mentioned above are missing and/or throw UnimplementedError when called.
Sql.named('SELECT ...') to keep the default
name- and Map-based query @variable`` substitution, or you may use the raw $1` version (with 1-based indexes).If you have any issues with migration or with the new behavior, please open an issue on the package's GitHub issue tracker or discussions.
The rewrite happened because of many contributions (including code, comments or criticism) on the new direction and design. I'd like to call out especially to simolus3 and osaxma, who helped to push forward.
*see the latest 3.0.0 (pre)release*
see the latest 3.0.0 (pre)release
*see the latest 3.0.0 (pre)release*
see the latest 3.0.0 (pre)release
*see the latest 3.0.0 (pre)release*
see the latest 3.0.0 (pre)release
Nothing published for this version
Breaking change in package:postgres/messages.dart: default constructors made internal, parsing is done with more efficient reader.
encoding to be specified for connections. The setting will be used for all connection-related string conversions.List type as substitution values in binary encoding (as long as the inner type matches).UTF8BackedString with generic encoding (not complete).package:postgres/messages.dart: default constructors made internal, parsing is done with more efficient reader.Improved (experimental) v3 implementation. #98 and #102 by simolus3.
Added support for bigInt (int8) arrays. #41 by schultek.
Adding lowerCase values to AuthenticationScheme.
package:lints.AuthenticationScheme.package:postgres/postgres_v3_experimental.dart library as a preview.
It exposes the postgres client under a new API that will replace the current
one in version 3.0.0 of this package.
At the moment, the new library is experimental and not fully implemented. Until the
actual 3.0.0 release, the new APIs might change without a breaking version.Connecting without a password for non-trusted users throws an exception instead of timing out #68 by osaxma.
Use substitutionValues with useSimpleQueryProtocol #62 by osaxma
Added Support for Streaming Replication Protocol which included the following changes:
PostgreSQLConnection: addMessage to send client messages, messages stream to listen to server messages & useSimpleQueryProtocol option in query method. #51 by osaxmaFix crash when manually issuing a transaction statement like BEGIN without using the high-level transaction APIs. #47 by simolus3.
Added support for boolean arrays. #41 by slightfoot.
Your coding agent can read these notes before it upgrades. Set up the MCP server →