A helper library for node-postgres that fetches OIDs for custom PostgreSQL data types (e.g., PostGIS geometry, geography) and provides a lookup table to use with pg.setTypeParser. Current stable version is 3.0.0. Released infrequently; relies on pg package (any version). Differentiates by simplifying the process of registering custom type parsers without manually querying pg_type.
npm install pg-custom-typesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to PostgreSQL, fetches OIDs for PostGIS geometry and geography types, then uses them in a query.
Replace first argument with a query function: types.fetcher({ query: pg.Client.prototype.query.bind(connection) }, connection).Use oids[21842552] or iterate Object.keys(oids). The README example shows keys as numbers, but variable names like 'geometry' are misleading. Expect numeric keys.
Use types.fetcher({ query: (sql, cb) => client.query(sql, cb) }, client).Replace with const types = require('pg-custom-types') or import types from 'pg-custom-types'Verify type names exist in the database and that connection points to correct db.