Registry / database / pg-type-names

pg-type-names

JSON →
library1.0.0jsnpmunverified

Provides lookup tables mapping PostgreSQL OIDs to data type names and descriptions. v1.0.0 is the current stable version; no recent updates. Lightweight utility for node-postgres ecosystem. Differentiator: simple OID-to-name mapping with reverse lookup, plus human-readable descriptions.

npm install pg-type-names
INSTALL
IMPORT
SIG · PG-TYPE-NAMES
P
pg-type-names
databasejavascriptv1.0.0
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.

names
import { names } from 'pg-type-names'
import pgTypeNames from 'pg-type-names'
The package exports named objects, not a default export.
oids
import { oids } from 'pg-type-names'
const oids = require('pg-type-names').oids
Require is valid, but import is preferred for consistency with modern projects.
descriptions
import { descriptions } from 'pg-type-names'

Import and use pg-type-names to look up PostgreSQL type names by OID, reverse lookup, and get descriptions.

import { names, oids, descriptions } from 'pg-type-names'; console.log(names[20]); // bigint console.log(oids['bigint']); // 20 console.log(descriptions['bigint']); // ~18 digit integer, 8-byte storage // Using CommonJS const types = require('pg-type-names'); console.log(types.names[20]); // bigint
Debug
Known issues
gotchaOID 0 (zero) is not a valid type and may return undefined
fix
Check for undefined when accessing names[0]
affects: >=1.0.0
gotchaOnly common built-in Postgres types are included; custom or extension types are not mapped
fix
Add custom mappings manually or use another library like pg-types
affects: >=1.0.0
deprecatedThis package is not actively maintained; last update 2016
fix
Consider using pg-types directly for more complete type mapping
affects: >=1.0.0
gotchaThe descriptions are short English phrases, not official Postgres documentation
fix
Refer to Postgres docs for authoritative type information
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'pg-type-names'
Package not installed or typo in import
fix
Run `npm install pg-type-names` and ensure case-correct import
TypeError: Cannot read property 'bigint' of undefined
Importing default export instead of named exports
fix
Use `import { oids } from 'pg-type-names'`
undefined when accessing names[0]
OID 0 is not a valid PostgreSQL type OID
fix
Check for existence before use: `names[oid] ?? 'unknown'`
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
pg-type-names — npm install pg-type-names · libregistry