postgres

Postgres.js - The Fastest full featured PostgreSQL client for Node.js, Deno, Bun and CloudFlare

UNLICENSE License

Downloads
1.7M
Stars
6.8K
Committers
70

Bot releases are hidden (Show)

postgres -

Published by porsager over 2 years ago

  • Run tests with github actions b536d0d
  • Add custom socket option - fixes #284 5413f0c
  • Fix sql function overload type inference (#294) 3c4e90a
  • Update deno std to 0.132 and enable last tests 50762d4
  • Send proper client-encoding - Fixes #288 e5b8554

https://github.com/porsager/postgres/compare/v3.0.2...v3.0.3

postgres -

Published by porsager over 2 years ago

  • Fix BigInt handling 36a70df
  • Fix unsubscribing (#300) b6c597f
  • Parse update properly with identity full - Fixes #296 3ed11e7

https://github.com/porsager/postgres/compare/v3.0.1...v3.0.2

postgres -

Published by porsager over 2 years ago

  • Improve connection queue handling + fix leak cee1a57
  • Use publications option - fixes #295 b5ceecc
  • Add types to debug signature dbb668c
  • Throw proper query error if destroyed e148a0a
  • Transaction rejects with rethrown error - fixes #289 f7c8ae6
  • Only create origin stacktrace for tagged and debug - fixes #290 a782edf
  • Include types and readme in deno release - fixes #287 9068820
  • Disable fetch_types for Subscribe options 72e0cdb
  • Update TypeScript types with v3 changes (#293) db05836

https://github.com/porsager/postgres/compare/v3.0.0...v3.0.1

postgres -

Published by porsager over 2 years ago

This is a complete rewrite to better support all the features that I was trying to get into v2. There are a few breaking changes from v2 beta, which some (myself included) was using in production, so I'm skipping a stable v2 release and going straight to v3.

Here are some of the new things available, but check the updated docs.

  • Dynamic query builder based on raw sql
  • Realtime subscribe to db changes through logical replication
  • Multi-host support for High Availability setups
  • Postgres input parameter types from ParameterDescription
  • Deno support
  • Cursors as async iterators
  • .describe() to only get query input types and column definitions
  • Support for Large Objects
  • max_lifetime for connections
  • Cancellation of requests
  • Converted to ESM (with CJS support)
  • Typescript support (Credit @minigugus)

Breaking changes from v2 -> v3

  • Cursors are always called with Result arrays (previously cursor 1 would return a row object, where > 1 would return an array of rows)
  • .writable() and .readable() is now async (returns a Promise that resolves to the stream)
  • Queries now returns a lazy promise instead of being executed immediately. This means the query won't be sent until awaited (.then, .catch, .finally is called) or until .execute() is manually called.
  • .stream() is renamed to .forEach
  • Returned results are now it's own Result class extending Array instead of an Array with extra properties (actually shouldn't be breaking unless you're doing something funny)
  • Parameters are now cast using the types returned from Postgres ParameterDescription with a fallback to the previously inferred types
  • Only tested with node v12 and up
  • Implicit array value to multiple parameter expansion removed (use sql([...]) instead)

Breaking changes from v1 -> v2 (v2 never moved on from beta)

  • All identifiers from sql() in queries are now always quoted
  • Undefined parameters are no longer allowed
  • Rename timeout option to idle_timeout
  • Default to 10 connections instead of number of CPUs
  • Numbers that cannot be safely cast to JS Number are returned as string. This happens for eg, select count(*) because count() returns a 64 bit integer (int8), so if you know your count() won't be too big for a js number just cast in your query to int4 like select count(*)::int

https://github.com/porsager/postgres/compare/v1.0.2...v3.0.0

postgres -

Published by porsager over 2 years ago

postgres -

Published by porsager over 2 years ago

  • Fix race condition with transactions on end 315407e

https://github.com/porsager/postgres/compare/v3.0.0-rc.1...v3.0.0-rc.2

postgres -

Published by porsager over 2 years ago

This is a complete rewrite to better support all the features that I was trying to get into v2. There are a few breaking changes from v2 beta , which some (myself included) are using in production, so I'm skipping a stable v2 release and going to v3.

Here are some of the new things available..

  • Converted to ESM with CJS support
  • Deno support
  • Dynamic query builder based on raw sql
  • Realtime subscribe to db changes through logical replication
  • Cursors as async iterators
  • Multi-host support for High Availability setups
  • Postgres input parameter types from ParameterDescription
  • .describe() to only get query input types and column definitions
  • Support for Large Objects
  • max_lifetime for connections
  • Cancellation of requests

Breaking changes from v2 -> v3

  • Cursors are always called with Result arrays (previously cursor 1 would return a row object, where > 1 would return an array of rows)
  • .writable() and .readable() is now async (returns a Promise that resolves to the stream)
  • Queries now returns a lazy promise instead of being executed immediately. This means the query won't be sent until awaited (.then, .catch, .finally is called) or until .execute() is manually called.
  • .stream() is renamed to .forEach
  • Returned results are now it's own Result class extending Array instead of an Array with extra properties (actually shouldn't be breaking unless you're doing something funny)
  • Parameters are now cast using the types returned from Postgres ParameterDescription with a fallback to the previously inferred types
  • Only tested with node v12 and up
  • Implicit array value to multiple parameter expansion removed (use sql([...]) instead)

Breaking changes from v1 -> v2 (v2 never moved on from beta)

  • All identifiers from sql() in queries are now always quoted
  • Undefined parameters are no longer allowed
  • Numbers that cannot be safely cast to JS Number are returned as string. This happens for eg, select count(*) because count() returns a 64 bit integer (int8), so if you know your count() won't be too big for a js number just cast in your query to int4 like select count(*)::int

https://github.com/porsager/postgres/compare/v2.0.0-beta.11...v3.0.0-rc.1

postgres -

Published by porsager almost 3 years ago

  • Fix listen reconnect on connection errors + simple backoff 09592ea

https://github.com/porsager/postgres/compare/v2.0.0-beta.10...v2.0.0-beta.11

postgres -

Published by porsager about 3 years ago

postgres -

Published by porsager about 3 years ago

  • Subscribe to changes using logical replication (#220) 51d033c
  • Fix #85 ce80061
  • Fix slow parsing of large messages (#229) 2c3353b
  • Expose PostgresError on module (#227) e954dba
  • transform.column.to support (#212) a02de67

https://github.com/porsager/postgres/compare/v2.0.0-beta.8...v2.0.0-beta.9

postgres -

Published by porsager about 3 years ago

  • Call socket.write with correct arguments - fixes #216 f406426

https://github.com/porsager/postgres/compare/v2.0.0-beta.7...v2.0.0-beta.8

postgres -

Published by porsager about 3 years ago

  • Fix potential endless loop 8150005
  • Recreate prepared statements if invalidated (#195) 591d47a
  • Copy (#211) 8e675a3
  • Add raw() method - fixes #194 (#196) 8b405b3
  • Use correct SSL mode description (#210) 1e7713e
  • Prevent obscuring errors when querying pg_catalog (#204) e3ace38
  • Optionally disable fetching of array types. (#205) 779771a
  • Fix return type definition f900c58

https://github.com/porsager/postgres/compare/v2.0.0-beta.6...v2.0.0-beta.7

postgres -

Published by porsager over 3 years ago

  • Use keepalive with 1 minute idle time 60c1f8e
  • Include custom types when fetching array types. (#103) 174e4fd
  • Make cursor work with unsafe - fixes #149 b15861d
  • Properly throw initial cursor errors 1b7e9b9
  • Include missing last set in cursor - fixes #150 #81 cea5f73
  • Fix #188 Support escaping dynamic schemas and tables 2e3652b
  • Handle disable and false sslmode url strings - fixes #177 0eff017
  • Add support for prepared statements in sql.unsafe (#176) ae6c350

https://github.com/porsager/postgres/compare/v2.0.0-beta.5...v2.0.0-beta.6

postgres -

Published by porsager over 3 years ago

  • Feature: Add raw input property to error and debug parameters (#167) 9e83e7f
  • Feature: Multihost support for High Availability setups (#158) 16bc7db
  • Feature: Add unlisten support (#155) 6ef71c8
  • Feature: Add sslmode prefer and require 0cb2981
  • Fix: Catch connection errors in begin() (transactions) - fixes #162 fff6640
  • Fix: Escaping columns for helpers and listen 00a10b2
  • Fix: Properly cleanup sockets (#136) c5bfcf2

https://github.com/porsager/postgres/compare/v2.0.0-beta.4...v2.0.0-beta.5

postgres -

Published by porsager over 3 years ago

  • Better sql`` types (#84) f82d679
  • Fallback to user for db name instead of 'postgres' - fixes #141 0b33b71

https://github.com/porsager/postgres/compare/v2.0.0-beta.3...v2.0.0-beta.4

postgres -

Published by porsager over 3 years ago

  • Fix parallel SCRAM-SHA-256 authentication (#145) 0709db4
  • Expose the PostgresError type for TypeScript (#99) 4d5fdc1
  • Fix type of timeout (#118) c2c0bf1

https://github.com/porsager/postgres/compare/v2.0.0-beta.2...v2.0.0-beta.3

postgres -

Published by porsager about 4 years ago

  • double precision can be represented safely as number in js 5e5ae5a
  • Fix .end() hanging as pending forever a5daa3e
  • Ensure end is called for connections not ready 219fa27
  • Fix support for node 8 and 10 3f6bbab

https://github.com/porsager/postgres/compare/v2.0.0-beta.1...v2.0.0-beta.2

postgres -

Published by porsager about 4 years ago

  • Fix wrong api usage errors being swallowed a891603
  • Fix connection config errors being swallowed 869ab9b
  • Add no_prepare option - fixes #93 and #76 ce14949

https://github.com/porsager/postgres/compare/v2.0.0-beta.0...v2.0.0-beta.1

postgres -

Published by porsager over 4 years ago

Potential Breaking changes

  • Undefined values throws 758b5ee
  • Treat postgres bigint as string by default 4958e80
  • Default to 10 connections instead of number of cpus e61e8f4
  • Don't force 1700 (numeric), postgres casts better - Fixes #41 844e7f2
  • Fix unsafe queries wrongly making named prepared statements d354edf

Deprecated

  • Rename timeout option to idle_timeout 90865cd

New

  • Typescript support (#8) c55304e
  • Add cursor support 4156c3f
  • Better errors - include origin, query, parameters 7845fc7
  • Update license to the Unlicense (#80) e8e86f8
  • Add connect_timeout with a default of 30 seconds 2e01c2b
  • Add columns to result - fixes #18 d89f824
  • Add PostgresError type fc6804a
  • Add async stack to end of error stack a74e015

Fixes

  • Fix #49 and improve sql.array usage 22651e3
  • Fix connection timeout leak 5e3fff8
  • Fix stale connections after initial error 807f983
  • Fetch os.username() optimistically - fixes #51 a519e18
  • Fix some errors not throwing for current query 87b0943
  • Fix CONNECTION_CLOSED false and no host + port if path is false 93ad859
  • Fix end timeout race condition 60dc30f
  • Register array types properly 7d3ce4b

https://github.com/porsager/postgres/compare/v1.0.2...v2.0.0-beta.0

postgres -

Published by porsager over 4 years ago

  • Fix standard postgres user env var (#20) cce5ad7
  • Ensure url or options is not falsy bc549b0
  • Add support for dynamic password b2ab9fb
  • Fix hiding pass from options 3f76b98

https://github.com/porsager/postgres/compare/v1.0.1...v1.0.2