{"id":43535,"library":"pg-aa","title":"pg-aa","description":"An ES7 wrapper for node-postgres that provides a simplified, promise-based API for common PostgreSQL operations including select, insert, update, delete, and transaction management with savepoint support. Current stable version is 2.1.6. The library is minimal (< 150 lines) and relies on async/await. It supports nested transactions via savepoints and works with template string engines like sql-template. Key differentiators: very thin abstraction over node-postgres, no ORM features, pure async/await pattern.","status":"active","version":"2.1.6","language":"javascript","source_language":"en","source_url":"https://github.com/131/pg-aa","tags":["javascript"],"install":[{"cmd":"npm install pg-aa","lang":"bash","label":"npm"},{"cmd":"yarn add pg-aa","lang":"bash","label":"yarn"},{"cmd":"pnpm add pg-aa","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Underlying PostgreSQL driver; pg-aa is a wrapper around node-postgres","package":"pg","optional":false},{"reason":"Used for debugging/logging","package":"debug","optional":true}],"imports":[{"note":"Default import for ES modules; commonjs require also works","wrong":"const pg = require('pg-aa')","symbol":"default","correct":"import pg from 'pg-aa'"},{"note":"CommonJS require returns the class directly","wrong":"var pg = require('pg-aa').default","symbol":"pg","correct":"var pg = require('pg-aa')"},{"note":"The package exports a single class; no named exports","wrong":"import { Client } from 'pg-aa'","symbol":"Client","correct":"import pg from 'pg-aa'"}],"quickstart":{"code":"import pg from 'pg-aa';\nimport SQL from 'sql-template';\n\nconst conString = \"postgres://postgres:1234@localhost/postgres\";\nconst client = new pg(conString);\n\n(async () => {\n  const line = await client.row(SQL`SELECT * FROM users WHERE id=${22}`);\n  if (!line) throw new Error(\"Missing user\");\n\n  await client.insert(\"users_log\", {\n    user_id: 22,\n    time: Date.now(),\n  });\n\n  const rows = await client.select('users', { active: true });\n  console.log(rows);\n\n  await client.end();\n})().catch(console.error);","lang":"typescript","description":"Connect to PostgreSQL using pg-aa, query a row, insert a log, select all active users."},"warnings":[{"fix":"Use default import or require directly: import pg from 'pg-aa'","message":"The package exports a single class as default; attempting to destructure or import named exports will fail.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use a full connection string like 'postgres://user:pass@localhost/db'","message":"Connection string must include credentials; no pooling configuration is exposed.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Always call client.end() after finishing queries.","message":"The .end() method must be called to close the client connection; forgetting causes hanging processes.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'150':43 '2.1.6':38 'aa':3 'abstract':69 'api':18 'async/await':48,78 'base':17 'common':20 'current':34 'delet':27 'differenti':66 'engin':60 'es7':5 'featur':76 'includ':23 'insert':25 'javascript':80 'key':65 'librari':40 'like':61 'line':44 'manag':30 'minim':42 'nest':51 'node':9,72 'node-postgr':8,71 'oper':22 'orm':75 'pattern':79 'pg':2 'pg-aa':1 'postgr':10,73 'postgresql':21 'promis':16 'promise-bas':15 'provid':12 'pure':77 'reli':46 'savepoint':32,54 'select':24 'simplifi':14 'sql':63 'sql-templat':62 'stabl':35 'string':59 'support':33,50 'templat':58,64 'thin':68 'transact':29,52 'updat':26 'version':36 'via':53 'work':56 'wrapper':6","created_at":"2026-06-05T17:00:15.867904+00:00","updated_at":"2026-06-05T17:00:15.867904+00:00","problems":[{"fix":"Use import pg from 'pg-aa' instead of import { pg } from 'pg-aa'","cause":"Using wrong import style (e.g., named import) when default is expected.","error":"TypeError: pg_aa_1.default is not a constructor"},{"fix":"Ensure you create an instance: const client = new pg(conString)","cause":"Forgot to call new pg(conString) or provided invalid connection string.","error":"Cannot read property 'query' of undefined"}],"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/131/pg-aa#readme","github":"https://github.com/131/pg-aa","docs":null,"changelog":null,"pypi":null,"npm":"pg-aa","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}}