Patch Changes
-
#7426
534b8b9Thanks @tim-smart! - Replace@effect/sql-pg'spgruntime with a native PostgreSQL client.PgConnectionandPgPoolnow handle connection setup, binary queries, prepared statements, pipelining, streaming, notifications, cancellation, and custom codecs.PgConnection.listenandPgClient.listenreturn scoped notification dequeues after PostgreSQL confirms the subscription.PgClientuses the native stack, and the legacyfromPool,fromClient, andmakeWithconstructors are removed.Breaking changes
fromPool,fromClient, andmakeWithare removed. Usemakefor a pool ormakeClientfor one connection.PgClient.listenreturns a scopedEffect<Dequeue<string>, SqlError, Scope>instead of aStream. Acquisition completes after PostgreSQL confirmsLISTEN, so notifications sent after it returns cannot be missed.PgClientConfig.typesnow accepts aPgTypes.Registryinstead ofpg.CustomTypesConfig. Plain object parameters are no longer inferred as JSON; wrap them withsql.json.- Query strings must contain one statement. PostgreSQL's extended protocol rejects multi-statement strings.
- Results use the native binary codecs. In particular,
int8decodes tobigint,dateto a string, timestamps to Unix epoch milliseconds, andbyteaor unknown OIDs toUint8Array.executeRawreturns the nativePgConnection.Resultshape rather thanpg.Result. - Named prepared statements are enabled by default. Set
prepare: falsewhen using a pooler that cannot preserve prepared statements between queries.Statement.unpreparedandStatement.valuesUnprepareduse unnamed extended queries without adding entries to the prepared-statement cache.
Inferred parameters stay permissive: strings bind untyped so the backend derives the type from the statement, and safe integers beyond the
int4range bind asint8.Add
Pool.reservefor exclusive access to a concurrent pool item, and fix waiter wakeups and capacity replacement after invalidation. -
#7509
c405edcThanks @tim-smart! - Set the defaultmultiplexConcurrencyto 32 when PostgreSQL connection multiplexing is enabled. Set a lower value explicitly to limit how many statements share each connection. -
#7503
96ea948Thanks @tim-smart! - Allow each PostgreSQL pool connection to complete its first checkout before applyingconnectionTTL, so a zero TTL
disables connection reuse without entering an invalidate/reconnect loop. -
#7502
e203638Thanks @tim-smart! - Add amaxMessageSizeconnection option so PostgreSQL clients can receive backend messages larger than the 16 MiB default. -
#7524
0a08ae0Thanks @fubhy! - AddNetAddressundereffect/unstable/netfor MAC, IP, internet socket, and Unix socket addresses, with checked parsing, schemas, equality, canonical string serialization, and URL formatting. Companion modulesIpInterfaceandIpNetworkrepresent IP interfaces and CIDR networks.HTTP and socket servers now expose
NetAddress.SocketAddress. Replace TCPhostnameaccess withNetAddress.formatIp(address.address)and useUnixPathAddress.pathfor Unix sockets. URL helpers bracket IPv6 addresses and reject scoped IPv6. Bun and Deno HTTP server layers can now fail withServeErrorwhen listener address conversion fails.PostgreSQL
inetvalues now useIpInterface;cidrvalues useIpNetworkand reject addresses with host bits set. -
#7734
fe3830aThanks @kitlangton! - Honor explicitssloptions when PostgreSQL URLs usesslmode=preferorsslmode=allow. -
#7504
9adb9f2Thanks @tim-smart! - Reject PostgreSQL LISTEN and NOTIFY channel names longer than 63 UTF-8 bytes. -
Updated dependencies [
49e3901,b945ded,d6422f4,5a80204,53511ef,79ae49f,0d083ba,be0f822,debe8fd,a8588f9,f17eb0a,f30cbfe,78cc9c0,ccbdbd5,a63dcbf,b845b18,381b794,4ffcaf4,ba2fd82,02be94c,115d8c2,1452635,77f85fe,a3f2b31,310f8d3,291d616,48dbbb2,b43bfd6,1c89c78,9bbe1a5,dd99ab0,8f397ed,d7ae6b6,8cf1203,87654c5,f05ae0b,436f5eb,d8ff960,8766475,b64f406,4697aaa,cec6c2d,9956f0e,5c7eed0,183c2ea,1e92dbd,4eb0fa7,534b8b9,b76a1cf,acc1e53,4950a91,c020987,abe95d1,027ceb9,3d203b7,a29b8f4,ce4aa65,a8ea807,a3ebb7f,473bd81,53843f6,c5eca65,d6f9eba,8d1e97a,b28ab48,9960708,8ac53b6,84ad49a,72cfa24,95c2581,d5c7cd2,fe4fed1,d150a64,05b1e80,414dc90,3f51acd,d68ff05,f3cf1e6,6525771,4ab4e83,f7f1d78,47b358a,45ffa72,6232650,4b73e1b,284050c,c85fc0b,7999b07,7d455f5,d681c2e,84d2a47,ed74b18,2245997,d386979,fc9fedf,7750dbe,fc91af6,39b9738,88093b5,d14c463,d473bd3,84864bc,e2ae724,f921ed3,1df933d,829aff9,aa0aba3,a71140f,0276a27,10d2c98,c86c999,975f758,2a3a478,1e6e206,fa6027b,7616f73,fc668b6,d425c8c,ce120f4,248201f,e80d397,f1a941d,73bc3a1,b628bb1,6e3ae7b,e891247,53e6c73,1579d6f,d3c6b73,4a59c6a,145d8e1,f74282c,0a38623,0a08ae0,fa6a56b,d60c5d4,07ffd25,9b517ad,604b1c1,ccc2e02,14d810a,a9d1ee3,a31adbe,7245f87,3a0828b,cd83544,6550a07,6f090d4,b505c0d,186dd49,9f37e58,4446451,58be972,1320075,ba53b64,f7490d4,c8ea602,62d82f4,a2c9e7c,97dd022,f984ee8,f1b2910,a29e05a,1aa1d8b,bb99734,222e7ca,797c9e3,b4d5398,c8349ed,8426e5f,26e0085,1a86166,0856631,0af0985,bc582c9,2c63f1e,0d98213,ca6f0dc,d8cc9ed,42fd969,5641ad3,629870d,d592c14,10d2c98,53909a9,78a4269,06c6307,0847c41,5a77084,96f99b3,7bb8781,4907e9b,2a30248,8364ddd,ad67d8c,ec0c087,fa6a56b,a2c1ce6,91e9af0,7bd3f34,ef16581,1693a87,df3fc47,e11be41,2e39e8b,11c5ee7,1742d2f,8efc70e,9642776,6680828,c34edcb,7b2c5bd,1a2ccee,db995df,af0ccdd,addeaea,7704034,e72b12f,310dd9c,1c2afc1,44f44ca,f43b9d6,56e72b3,50ef80e,fc3b718,ee336d8,d12f922,46d8310,59812fd,f9d0dec,4372c79,81485ef,bd393d6,0c95c04]:- effect@4.0.0-rc.113