-
Welcome | node-postgres
node-postgres is a collection of node.js modules for interfacing with your PostgreSQL database. It has support for callbacks, promises, async/await, connection pooling, prepared statements, cursors, s...
-
Connecting – node-postgres
node-postgres is a collection of node.js modules for interfacing with your PostgreSQL database.
-
Queries – node-postgres
await client.query('SELECT NOW() as now')
If you are passing parameters to your queries you will want to avoid string concatenating parameters into the query text directly. This can (and often does) l...
-
pg.Client – node-postgres
Client instance will use environment variables for all missing values.
type Config = {
user?: string, // default process.env.PGUSER || process.env.USER
password?: string or function, //default pro...
-
Data Types – node-postgres
date,
timestamp, or
timestamptz column value back into JavaScript, node-postgres will parse the value into an instance of a JavaScript
Date object.
const createTableText = `
CREATE TEMP TABLE dates...
-
Utilities – node-postgres
const { escapeIdentifier } = require('pg')
const escapedIdentifier = escapeIdentifier('FooIdentifier')
console.log(escapedIdentifier) // '"FooIdentifier"'
⚠️
Note: When using an identifier that is the...