Functions
PostgreSQL parameter binding
node-postgres integration, not Next.js API. Values bind to placeholders; identifiers need a fixed allowlist. Source: https://node-postgres.com/features/queries
Formal Syntax & Structure
nextjs syntaxnextjs
pool.query(text, values)Working Example
Example Snippetnextjs
// lib/books.ts — partial integration, reviewed pg dependency requiredimport 'server-only';import type {Pool} from 'pg';export async function findBook(pool:Pool,id:string) { const result=await pool.query('SELECT id,title FROM books WHERE id=$1',[id]); return result.rows[0] ?? null;}