{"id":42401,"library":"any-db-postgres","title":"any-db-postgres","description":"PostgreSQL adapter for the Any-DB abstraction layer, version 2.3.0. Provides a uniform interface for PostgreSQL connections and queries that conform to the Any-DB API, allowing application code to be portable across different databases by swapping adapters. Relies on the pg.js driver and extends pg.Client and QueryStream for PostgreSQL-specific features. Note: the adapter is explicitly designed to be used as part of the any-db ecosystem and should not be used standalone; it requires the any-db package as a peer dependency.","status":"maintenance","version":"2.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/grncdr/node-any-db-postgres","tags":["javascript","any-db","anydb","postgres","pg","adapter"],"install":[{"cmd":"npm install any-db-postgres","lang":"bash","label":"npm"},{"cmd":"yarn add any-db-postgres","lang":"bash","label":"yarn"},{"cmd":"pnpm add any-db-postgres","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to use the adapter","package":"any-db","optional":false}],"imports":[{"note":"ESM import recommended; CommonJS require also works but may not be tree-shakable.","wrong":"const createConnection = require('any-db-postgres')","symbol":"createConnection","correct":"import { createConnection } from 'any-db-postgres'"},{"note":"Package has both default and named exports. Default export is the adapter object.","wrong":"const anyDBPostgres = require('any-db-postgres')","symbol":"default export","correct":"import anyDBPostgres from 'any-db-postgres'"},{"note":"Connection type is re-exported from any-db, not from the adapter.","wrong":"import { Connection } from 'any-db-postgres'","symbol":"Connection","correct":"import { Connection } from 'any-db'"}],"quickstart":{"code":"import { createConnection } from 'any-db-postgres';\nimport { createPool } from 'any-db';\n\nconst pool = createPool(createConnection, { url: 'postgres://user:password@localhost:5432/dbname' });\n\npool.query('SELECT 1 AS num', (err, result) => {\n  if (err) throw err;\n  console.log(result.rows[0].num); // 1\n  pool.close();\n});","lang":"typescript","description":"Creates a connection pool using the any-db-postgres adapter and runs a simple query."},"warnings":[{"fix":"Migrate to the 'pg' package directly and remove any-db dependency.","message":"The any-db project is no longer actively maintained; use direct pg library for new projects.","severity":"deprecated","affected_versions":">=2.0"},{"fix":"Use named import: import { createConnection } from 'any-db-postgres'","message":"The adapter's default export is the createConnection function, but the named export createConnection is also available; using default import may lead to confusion.","severity":"gotcha","affected_versions":">=2.0"},{"fix":"Uninstall 'pg' if not needed, and install 'pg.js' as a dependency.","message":"This adapter relies on the pg.js (not pg) driver. If you have both pg and pg.js installed, ensure the correct one is used.","severity":"gotcha","affected_versions":">=2.0"},{"fix":"Update code to use promises: pool.query('SELECT 1').then(...).catch(...)","message":"As of v2.0, the adapter no longer supports callbacks for pool.query; use promises or explicit callback patterns.","severity":"breaking","affected_versions":">=2.0"}],"env_vars":null,"search_vec":"'2.3.0':15 'abstract':12 'across':39 'adapt':6,44,62,101 'allow':33 'any-db':9,29,73,86,95 'any-db-postgr':1 'anydb':98 'api':32 'applic':34 'code':35 'conform':26 'connect':22 'databas':41 'db':3,11,31,75,88,97 'depend':93 'design':65 'differ':40 'driver':49 'ecosystem':76 'explicit':64 'extend':51 'featur':59 'interfac':19 'javascript':94 'layer':13 'note':60 'packag':89 'part':70 'peer':92 'pg':100 'pg.client':52 'pg.js':48 'portabl':38 'postgr':4,99 'postgresql':5,21,57 'postgresql-specif':56 'provid':16 'queri':24 'querystream':54 'reli':45 'requir':84 'specif':58 'standalon':82 'swap':43 'uniform':18 'use':68,81 'version':14","created_at":"2026-06-05T16:54:48.981877+00:00","updated_at":"2026-06-05T16:54:48.981877+00:00","problems":[{"fix":"npm install any-db","cause":"Missing peer dependency any-db","error":"Error: Cannot find module 'any-db'"},{"fix":"Use import { createConnection } from 'any-db-postgres'","cause":"Incorrect import: using default import instead of named import","error":"TypeError: createConnection is not a function"},{"fix":"Provide { url: 'postgres://...' } in the pool options","cause":"Missing url configuration for the pool","error":"Error: The 'url' property is required for creating a pool"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/grncdr/node-any-db-postgres#readme","github":"https://github.com/grncdr/node-any-db-postgres","docs":null,"changelog":null,"pypi":null,"npm":"any-db-postgres","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}