dargres 4.0.3
dargres: ^4.0.3 copied to clipboard
Dargres is a pure-Dart PostgreSQL driver based on Python pg8000
Changelog #
4.0.3 #
Fixed #
commit(and sorunInTransaction) of a transaction an error aborted completed without an error: PostgreSQL answers that COMMIT with a ROLLBACK, so a caller that caught the error took the rolled back writes for saved. It now rolls back and throws aPostgresqlExceptionwithserverErrorCode25P02; after aROLLBACK TO SAVEPOINTthe transaction commits as before.
4.0.2 #
Fixed #
- TLS (
sslContext,requireSsl) failed on every connection withHandshakeException: Connection terminated during handshake: the subscription that read the answer to the SSLRequest was cancelled before the socket was handed toSecureSocket.secure, which ended the socket. It is paused instead, as postgres 3.x does.
4.0.1 #
Details: doc/release_notes_4.0.1.md.
Fixed #
-
money(andmoney[]) is the exact decimal amount ('1234.56','-0.05'), as postgres_fork returns it. It was the lc_monetary text ('R$ 1.234,56'), with the currency symbol and the locale's separators. -
float4read in text (cold executions, simple protocol) gave the shortest decimal (0.1), and in binary (warm executions) the float4 value (0.10000000149011612), so the same query returned two different doubles. Text is now read as a float4 and widened, as the binary format;float4[]too. -
DateTime parameters carry their zone: a local DateTime was sent without its offset, so the server read it in the session time zone (a process in UTC with a session in America/Sao_Paulo stored timestamptz three hours off).
-
Transaction commands (
COMMIT,ROLLBACK,SAVEPOINT) could wait forever after the transaction awaited other I/O, e.g. a second pool lease. -
PostgreSqlPoolopens connections on demand instead of all slots at once. -
Text
date/timestamp/timestamptzdecoding no longer depends on the OS time zone (DST-gap shift, BC dates and LMT offsets now match binary). -
?placeholders after a literal ending in\are rewritten correctly. -
Typo in the missing MD5 password error message.
-
A query issued on a
CoreConnection(not on theTransactionContext) while another caller'srunInTransactioncallback ran failed on the extended protocol (queryNamed,queryUnnamed,queryMaps, ...: "A transaction is active"); it now waits for the commit or rollback, as the simple protocol did. Issued from the callback itself, it runs in the transaction (it threw, or forexecutewaited forever). SeequeueConcurrentCalls. -
A queued transaction no longer runs ahead of queries that arrived before it, and a query that waited for another caller's preparation of the same statement keeps its place: queries and transactions run in arrival order.
-
runInTransaction/beginTransactionfrom inside arunInTransactioncallback fails with aStateError(it waited for itself forever). -
COPY ... FROM STDINhung the connection, and every caller queued behind it, forever; it now fails with SQLSTATE 57014 (there is no COPY IN API). -
An unnamed prepared statement (
prepareStatement(isUnamedStatement: true)) executed whatever statement was parsed unnamed last, e.g. any caller'squeryUnnamed: silently wrong results. It is parsed again on execution. -
CoreConnection.executeStatement(isDeallocate: true)reported a failed execution as an uncaught asynchronous error. -
Text
float8andnumericwere not correctly rounded (0.1 + 0.2read as0.3000000000000001, the float8 maximum asInfinity, subnormals as0): a cold (text) and a warm (binary) execution of one statement returned different doubles. -
Array parameters: a
'null'string element was sent as SQL NULL, and a NaN or infinite double element failed with 22P02. -
Multidimensional arrays, arrays with explicit bounds (
[0:1]={1,2}) andjson[]/jsonb[]with non-object elements failed to decode. -
DateTimeparameters with a year before 1 (BC) or after 9999 were rejected by the server. -
DEALLOCATE PREPARE ALL, andDEALLOCATE ALL/DISCARD ALLafter other statements of a simple query, left the statement cache stale: the next cached query failed with 26000. -
A query issued on the connection from a
runInTransactioncallback after the connection died under that transaction ran outside it, autocommitted on the reconnected session; it now fails with aStateError. -
With
textCharset: 'ascii', a non-ASCII NOTICE (any localized one), notification payload or ParameterStatus closed the connection.
Added #
searchPathandsessionStatements, applied to every physical session (pool slots and reconnects included) beforeconnect()completes.client_encoding(fromtextCharset) andDateStyle=ISOin the startup packet.- Opt-in
numericAsStringfor exactnumericvalues. queueConcurrentCalls(defaulttrue) onConnectionSettingsandCoreConnection;falsemakes queries from outside a running transaction fail instead of waiting.repositoryandissue_trackerin the pubspec.
4.0.0 #
Details: doc/release_notes_4.0.0.md and PERFORMANCE_MIGRATION.md.
High-performance rewrite: 2.0x–2.75x faster than postgres_fork in the
recorded 10,000-row benchmarks (JIT and AOT).
Added #
- Direct query APIs
queryMaps,queryTyped<T>,queryEachandqueryCached, withRowViewand per-columnResultSchemadecoders. - Per-connection LRU prepared-statement cache (
statementCacheCapacity). - Selective binary result decoding, plus opt-in
requireBinaryResults. - Opt-in IANA time zone decoding.
ReconnectPolicy,ping()/checkHealth(), command timeout withCancelRequest, andcancelCurrentQuery().- Bounded pool admission queue (
maxPendingOperations,PoolQueueFullException) and pool metrics. - Zero runtime dependencies (internal crypto, encodings and pool).
Changed #
- Cold queries send
Parse + Describe + Bind + Execute + Syncin one batch; cache hits send onlyBind + Execute + Sync. PostgreSqlPoolleases one physical connection per operation/transaction and replaces sockets closed by timeouts.- Hardened connect/reconnect/close, SCRAM and socket flushing.
- Minimum Dart SDK
^3.6.0.
Breaking changes #
Row[]returnsObject?.- The direct APIs take named parameters;
?placeholders are never auto-detected. RowViewis valid only inside its synchronous callback;queryEachdoes not await asynchronous callbacks.PostgreSqlPoolno longer implementsConnectionInterface.CoreConnection.close()is terminal.- Removed
QueryState/Query.state,PostgreSqlPool.restartOnTimeoutand transactiontimeoutInner.
3.1.2 #
- Fixed the default
Locationinitialization to use UTC.
3.1.1 #
- Added flags to
TimeZoneSettingsfor more flexible decoding ofdate,timestamp, andtimestamptzvalues.
3.1.0 #
- Breaking change: decoded
timestamp without time zoneas a localDateTimeand decodedtimestamp with time zoneusing the timezone defined on the connection.
3.0.2 #
- Fixed setting
application_nameon PostgreSQL versions earlier than 8.2.
3.0.1 #
- Fixed a critical stack-overflow bug introduced in 3.0.0. Timeout parameters
were removed from query execution methods such as
queryNamed,queryUnnamed,querySimple,execute,prepareStatement, andexecuteStatement.
3.0.0 #
- Implemented
PostgreSqlPoolwith optional automatic reconnect after a connection drop.
final settings = ConnectionSettings(
user: 'user',
database: 'database',
host: 'localhost',
port: 5433,
password: 'password',
textCharset: 'latin1',
applicationName: 'dargres',
);
final conn = PostgreSqlPool(
2,
settings,
allowAttemptToReconnect: true,
);
2.2.4 #
- Added Windows-1252 (
win1252) support toCoreConnection.
final con = CoreConnection(
'user',
database: 'db',
host: 'localhost',
port: 5432,
password: 'pass',
textCharset: 'win1252',
);
2.2.3 #
- Fixed a serious intermittent error when executing prepared statements for
SELECTqueries that return large amounts of data.
2.2.2 #
- Fixed query-error and database-restart handling bugs.
2.2.1 #
- Fixed bugs in
queryUnnamedandprepareStatement.
2.2.0 #
- Implemented
ResultStreamandResultsfor data returned byqueryUnnamedandquerySimple.
2.1.0 #
- Added placeholder-style selection to
queryUnnamedandprepareStatement, including PHP PDO-style question-mark parameters.
queryUnnamed(
'SELECT * FROM book WHERE title = ? AND code = ?',
['title', 10],
placeholderIdentifier: PlaceholderIdentifier.onlyQuestionMark,
);
2.0.0 #
- Migrated the package to null safety.
1.0.1 #
- Fixed an insert bug and implemented
queryUnnamedfor unnamed prepared statement execution.
1.0.0 #
- Initial version.