dox_postgres_native 3.0.0-alpha.7
dox_postgres_native: ^3.0.0-alpha.7 copied to clipboard
Fast native Postgres client for Dart, the default Postgres driver of the Dox ORM. Rust (tokio-postgres) owns the connections, your code stays in Dart.
3.0.0-alpha.7 #
-
The package moved to its own repository: https://github.com/dartondox/dox-postgres-native. The ready-built libraries are on its releases (tag
v<version>). -
Breaking: isolates that open the same settings (and the same
maxConnections) now share one pool in Rust, likedox_mysql_native. SomaxConnectionsis for the whole process, not per isolate. Before, 8 isolates with the default of 10 could open 80 connections. Eachopencounts, and only the lastclose()closes the pool. The native ABI version is now 2. -
The prepared statement cache of a connection drops the statement used longest ago when it is full (LRU, 512 statements). Before, it dropped all statements at once.
-
Fewer copies of the result bytes. Rust writes each result straight into the buffer of the next post. A batch of 64 KiB or more goes to Dart without a copy (external typed data).
-
Faster decode of
uuid,numeric,date,jsonandjsonb, without the type registry of thepostgrespackage. A negativenumericbelow 1 now has its leading zero:-0.5, not-.5like thepostgrespackage. -
An
intparameter is written as text straight into the request buffer, without aString. It still goes without a type, so the server picks it. -
The column names are kept per SQL text, not only for the last result. Queries that take turns no longer decode their column names again.
-
Breaking: no more
postgrespackage. This package now has its own@nameparser, value encoder and errors. Dox has no Dart driver to fall back to. -
Breaking: errors are
PgException(withmessage) andPgServerException(withcode,severity,detail,hint,schema,table,column,constraint). TheServerExceptionclasses of thepostgrespackage are gone. -
Breaking: parameter values are
null,bool,int,double,String,DateTime,Duration,Uint8List(bytea),Map(json) andList(array). Another type throwsArgumentError.TypedValueis gone: use a cast in the SQL (@id::int8or@id:int8). -
Breaking: some result types changed.
intervalis aDuration(a month is 30 days),timeis aStringlike13:45:01.5, an infinite date or timestamp is'infinity'or'-infinity', and a type it does not know is its binary bytes (Uint8List). -
TLS with rustls. New
sslModeoption:disable(default),prefer,requireorverify-full.verify-fullchecks the certificate and host name with the Mozilla roots and the roots of the system. The TLS settings are part of the pool sharing key. -
New
PgNativePool.fromUrl('postgres://user:pass@host:5432/db?sslmode=require'). -
An error without a server code now tells its cause, eg.
error performing TLS handshake: invalid peer certificate: UnknownIssuer. -
The native ABI version is now 3 (
dpg_connecttakes the certificate check flag).
3.0.0-alpha.6 #
- Version bump only, to match the other packages.
3.0.0-alpha.5 #
- The hook comment says how to fill the sha256 list from a release:
dart run bin/native_hashes.dart <tag>. The list stays empty until the first release. - A
hostthat starts with/is a Unix socket folder (eg. Cloud SQL/cloudsql/project:region:instance). A test checks it.
3.0.0-alpha.4 #
- Less work per request. Rust copies a batch of requests once and keeps slices of it, instead of one copy of the SQL and of each parameter. A batch of plain queries uses one timeout timer, not one per query. Dart keeps waiting requests in a list, not a map.
3.0.0-alpha.3 #
- Column names and types are decoded once per result shape. The next result with the same columns reuses them.
- Breaking: this package no longer depends on
dox_orm.PostgresNativeDrivermoved intodox_orm, which now uses it as its default Postgres driver. This package keepsPgNativePool. - Fix: a request never got an answer in two cases. A value that Dart can
not decode (eg. a timestamp out of the
DateTimerange) lost every other result of the same batch. A request sent to a transaction after its end (eg. a second rollback) was dropped. Both now fail with a clear error. - A request that gets no answer in 5 minutes fails with a timeout error
(like
queryTimeoutof thepostgrespackage). Connect timeout is 15 s. A transaction that Dart does not end in 5 minutes is rolled back, so its connection goes back to the pool. tool/stress.dart: a stress test that finds requests that never finish.- Faster queries. Plain queries now share connections: tokio-postgres
sends the queries of one connection together (pipelining). One tokio task
runs each batch from Dart, not one task per query. The SQL bytes are
cached, and binding named parameters builds no extra
Set.
3.0.0-alpha.2 #
- First release.
- Native Postgres driver: Rust (tokio-postgres, deadpool-postgres) owns the connections. Your code stays in Dart.
PostgresNativeDriverfor the Dox ORM. Same types and exceptions as thepostgrespackage.PgNativePool: queries, transactions, one pool for many isolates.