Registry / database / pg-doc

pg-doc

JSON →
library0.2.2jsnpmunverified

Produce markdown schema documentation for your Postgres database. Version 0.2.2 is current. Release cadence is low (last update Jan 2023). It generates a markdown file with table listings, columns, types, and descriptions. Supports configuration via CLI, JSON file, or environment variables. Differentiator: simple, single-purpose tool vs. heavier solutions like SchemaSpy or DBDoc.

npm install pg-doc
INSTALL
IMPORT
SIG · PG-DOC
P
pg-doc
databasejavascriptv0.2.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pg-doc
npx pg-doc --db postgres://user:pass@localhost/mydb
import pgDoc from 'pg-doc'
CLI tool, not a library. Use npx or global install.

Installs pg-doc globally and generates a markdown schema file for a Postgres database.

npm install -g pg-doc pg-doc --db postgres://user:pass@localhost/mydb --out schema.md --title "My Database"
Debug
Known issues
gotchaConnection string must be provided via --db flag or .pg-doc.json. No database URL leads to error.
fix
Ensure --db option is passed or connection key in config file.
affects: >=0.1.0
gotchaTOC split-limit default is 20. If fewer tables, no splitting occurs.
fix
Adjust --split-limit if you want splitting for smaller schemas.
affects: >=0.2.0
deprecatedEnvironment variables use PGDOC prefix; note typo in PGDOC_NO_DESCRIPTIONSL variable name (extra 'L' at end).
fix
Use PGDOC_NO_DESCRIPTIONS (without extra L) if corrected in future versions, or use CLI flag instead.
affects: >=0.2.0
gotchaDescriptions from database comments take precedence over config file descriptions if both exist.
fix
Use --no-descriptions to ignore database comments and rely on config file descriptions.
affects: >=0.1.0
Errors
Common errors & fixes
Error: getaddrinfo ENOTFOUND localhost
Postgres host not reachable or connection string malformed.
fix
Check host, port, and ensure postgres is running. Use 'localhost' or 127.0.0.1.
Error: Cannot find module 'pg'
pg-doc depends on 'pg' but it's not installed.
fix
Run 'npm install pg' in the same directory, or install pg-doc globally with -g.
pg-doc: Option 'connection' is required
No database connection URL provided.
fix
Add --db postgres://user:password@host:port/database or use .pg-doc.json with 'connection' key.
Error: column "table_name" does not exist
Possibly using an old PostgreSQL version (pg-doc queries pg_catalog tables).
fix
Use PostgreSQL 9.3+ which supports information_schema.tables.
Upgrade
Version history
0.2.2latest on npm
Audit
Dependencies
pgrequiredPostgreSQL client for database connection
Agent activity
4 hits · last 30 days
node
4
Resources
packagepg-doc
pg-doc — npm install pg-doc · libregistry