- Added or fixed decoders support for
QueryMode.simple
:double
,real
,timestampWithTimezone
,timestampWithoutTimezone
,date
,numeric
,json
,jsonb
#338 by pst9354.
- Support for
tsvector
andtsquery
types. ResultRow.isSqlNull(int)
returns true if the column's value was SQLNULL
.TypedValue.isSqlNull
indicates SQLNULL
(vs. JSONnull
).
ConnectionSettings.onOpen
callback to initialize a new connection and set connection-level variables.
Added the following PostgreSQL builtin types:
- Geometric types
line
,lseg
,path
,polygon
,box
,circle
- Range types
int4range
,int8range
,daterange
,tsrange
,tstzrange
- Time type
time
- Array types
_int2
,_date
,_time
,_timestamp
,_timestamptz
,_uuid
Huge thanks for #294 by wolframm.
- Properly react to connection losses by reporting the database connection as closed.
- Allow passing a
SecurityContext
when opening postgres connections.
- Support for type
char
/character
/bpchar
.
- Fix: SSL connection problem handler.
- Using const for ConnectionSettings, SessionSettings and PoolSettings classes. (#267 by Gerrel)
- Parsing of
Sql.indexed
andSql.named
happens when theConnection
starts to interpret it. Errors with unknown type names are thrown in this later step.
- Fix: Dispose disconnected pool
Connection
s. (#260 by nehzata). - Deprecated
ParseMessage
constructor'stypes
argument, usetypeOids
instead. (As most users don't access this directly, it will be removed in3.1.0
).
- Fix: do not allow
execute
after closing theConnection
. Session.runTx()
supports rolling back the transaction throughTxSession.rollback()
(otherwise any exception has the same effect, but callers need to catch it).- Supporting more type aliases, including
serial4
,serial8
,integer
... - Deprecated all of v2 API, legacy fallback will be removed in next minor version (
3.1.0
).
New features:
- New API (better names and consistency).
- New SQL parsing and configurable query substitutions.
- Integrated connection pooling.
- A somewhat-compatible legacy API support to help migrations (will be removed in
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:
- Simple query protocol allows sending queries to the server without awaiting on the result. The new implementation queues these request on the client instead.
- Table name OIDs are not fetched or cached, this information from the
result schema is absent, also causing
mappedResultsQuery
to be removed from the new API. - Queries are not cached implicitly, explicit prepared statements can be used instead.
interval
values are returned asInterval
type instead ofDuration
.- A newly added
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 toString
and if that failed theUint8List
were used. - Types, fields and parameter names may have been renamed to be more consistent or more aligned with the Dart naming guides.
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.
- You may use the legacy compatibility layer to check if your code relies on any of the above mentioned feature, rewrite if needed.
- Start using the new API, incrementally, when possible.
- For most queries, you may use
Sql.named('SELECT ...')
to keep the default name- andMap
-based query@variable`` substitution, or you may use the raw
$1` version (with 1-based indexes). - Always write tests.
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
- Allow
encoding
to be specified for connections. The setting will be used for all connection-related string conversions. - Allow generic
List
type as substitution values in binary encoding (as long as the inner type matches). - Refactor: replaced
UTF8BackedString
with generic encoding (not complete). - Breaking change in
package:postgres/messages.dart
: default constructors made internal, parsing is done with more efficient reader.
- Updated to
package:lints
. - Adding lowerCase values to
AuthenticationScheme
. - Add new
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 version3.0.0
of this package. At the moment, the new library is experimental and not fully implemented. Until the actual3.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.
- Added Support for Streaming Replication Protocol which included the following changes:
- Replication Mode Messages Handling. #58 by osaxma
- Add new message types for replication. #57 by osaxma
- Add connection configuration for Streaming Replication Protocol. #56 by osaxma
- Raise the min sdk version to support enhanced enums. #55 by osaxma
- Add LSN type and time conversion to and from ms-since-Y2K. #53 by osaxma
- Fix affected rows parsing in CommandCompleteMessage. #52 by osaxma
- Introduced new APIs to
PostgreSQLConnection
:addMessage
to send client messages,messages
stream to listen to server messages &useSimpleQueryProtocol
option inquery
method. #51 by osaxma
- Fix 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.
- Added support for varchar arrays. #39 by paschalisp.
- Support for clear text passwords using a boolean parameter in connection as 'allowClearTextPassword' to activate / deactivate the feature. #20.
- Include original stacktrace when query fails. (#15 by davidmartos96)
- Fix error when sending json data with
execute()
#11
- Fix error when passing
allowReuse: null
intoquery()
#8
- Support for type
interval
, #10.
- Expose
ColumnDescription.typeId
.
- Added support for types
varchar
,point
,integerArray
,doubleArray
,textArray
andjsonArray
. (Thanks to schultek, #3)
- Finalized null-safe release.
- Fixing query API optional parameters.
- Updated public API to always return non-nullable results.
- BREAKING CHANGE: unknown mapped table name is no longer
null
, it is empty string (''
).
- Supporting Unix socket connections. (Thanks to grillbiff, #124)
- Preparation for custom type converters.
- Added rowsAffected to PostgreSQLResult. (Thanks to arturaz, #143)
- Fix
RuneIterator.current
use, which no longer returnsnull
in 2.8 SDK.
- Missing substitution value no longer throws
FormatException
. More details in the GitHub issue.
- Fixed startup packet length when username is null (#111).
- Finalized dev release.
- Restricted field access on [PostgreSQLConnection].
- Connection-level default query timeout.
- Option to specify timeout for the transaction's
"COMMIT"
query. - Optimized byte buffer parsing and construction with
package:buffer
. - Hardened codebase with
package:pedantic
and additional lints. - Updated codebase to Dart 2.2.
PostgreSQLResult
andPostgreSQLResultRow
as the return value of a query.- Returned lists are protected with
UnmodifiableListView
. - Exposing column metadata through
ColumnDescription
. - row-level
toTableColumnMap
andtoColumnMap
- Returned lists are protected with
PostgreSQLConnection
and_TransactionProxy
share the OID cache.- default value for
query(allowReuse = true)
is set only in the implementation method.
Breaking behaviour
- Table OIDs are always resolved to table names (and not only with mapped queries).
- Add connection queue size
- Prevent the table name resolution of OIDs <= 0.
- Adds support for Dart 2
- Add full support for
UUID
columns.
- Preserve error stacktrace on various query or transaction errors.
- Read support for
BYTEA
columns.
- Adds
Connection.mappedResultsQuery
to return query results as aMap
with keys for table and column names.
- Adds
Connection.notifications
to listen forNOTIFY
events (thanks @andrewst) - Adds better error reporting.
- Adds support for JSONB columns.
- Fixes issue when encoding UTF16 characters (thanks @andrewst)
- Allow connect via SSL.
- Fixed issue with buffer length
- Fixed issue with UTF8 encoding
- Bump for documentation
- Added transactions: PostgreSQLConnection.transaction and PostgreSQLConnection.cancelTransaction.
- Initial version