Skip to content
Back to skills

Postgresql Knowledge Patch

ASecurity

PostgreSQL

  • 25 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 5, 2026
developmentrustsqlexpressapidatabase

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 10 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill postgresql-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Postgresql Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Postgresql Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-postgresql-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-postgresql-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: postgresql-knowledge-patch
description: PostgreSQL
version: "19.0"
license: MIT
metadata:
  author: Nevaberry
---


# PostgreSQL Knowledge Patch

Load this skill when upgrading PostgreSQL, adapting SQL or client code,
configuring maintenance or replication, or updating monitoring and extensions.
Use the quick reference for compatibility decisions and the topic files for
complete guidance and examples.

## Reference index

| Reference | Topics |
| --- | --- |
| [Clients and CLI](references/clients-and-cli.md) | Authentication, TLS, libpq, psql, pgbench, notification recovery |
| [COPY, backup, and maintenance](references/copy-backup-and-maintenance.md) | Maintenance privileges, vacuum, repacking, I/O controls, COPY, dumps, backups |
| [Extensions and FDW](references/extensions-and-fdw.md) | C receive functions, index handlers, planner hooks, foreign server authentication and transactions |
| [JSON](references/json.md) | Constructors, serialization, nulls, paths, SQL/JSON query functions, relational projection |
| [Migration and compatibility](references/migration-and-compatibility.md) | Foreign-key repairs, collation changes, index rebuilds, names, encodings, support lifecycle |
| [Observability and planning](references/observability-and-planning.md) | Statistics, progress, I/O, memory, wait events, cache and lock capacity, planner advice |
| [Replication and recovery](references/replication-and-recovery.md) | WAL boundaries, standby replay, logical failover, upgrades, generated columns, sequences |
| [SQL and schema](references/sql-and-schema.md) | Partitioning, constraints, triggers, time zones, PL/pgSQL, UUIDs, collations |

## Upgrade blockers and removed interfaces

- PostgreSQL 19 removes RADIUS authentication. Replace `radius` rules in
  `pg_hba.conf` before upgrading.
- Before `pg_upgrade` to PostgreSQL 19, rename databases, roles, and tablespaces
  whose names contain a carriage return or line feed; those names are rejected.
- `pg_upgrade` rejects indexes using the `btree_gist` operator classes for `inet`
  or `cidr`. Drop affected indexes before the upgrade and recreate them with the
  built-in GiST operator classes, now the defaults for both types.
- Migrate databases using `MULE_INTERNAL` by dumping and restoring with a
  supported encoding.
- For foreign keys, each referencing/referenced column pair must both use
  deterministic collations or share the same nondeterministic collation.
  Correct incompatible pairs before dump/restore or `pg_upgrade`, since
  recreating the foreign key fails.
- Remove `io_workers` from configurations carried forward to PostgreSQL 19.
  Four settings replace it as part of automatic I/O worker scaling.
- Extensions using the removed `get_relation_info_hook` need to port their
  logic to `build_simple_rel_hook`, which runs at a different planning point.

## Repairs and text processing after upgrade

- Drop and recreate affected foreign keys on detached partitions referencing
  a partitioned table after the 17.1 update, and self-referencing foreign keys
  on partitioned tables that gained partitions after constraint creation after
  the 17.5 update. Correct violating rows before recreating a constraint; use
  the 17.1 diagnostic query to identify affected detached-table constraints.
- After updating to 14.24, run `REINDEX INDEX` on `btree_gist` indexes over
  `float4` or `float8` columns that might contain `NaN`, and over `bit` or
  `bit varying` columns. Also reindex B-tree indexes over `ltree` values with
  more than about 14,653 labels; older comparisons could leave them corrupt.
- PostgreSQL 18 full-text search reads configuration and dictionaries with the
  cluster's default collation provider. After `pg_upgrade`, rebuild full-text
  search and `pg_trgm` indexes on clusters whose non-libc provider differs from
  libc for `LC_CTYPE` character handling.
- PostgreSQL 19 full-text search and `pg_trgm` classify characters during
  parsing with each database's locale provider. After `pg_upgrade`, recompute
  stored `tsvector` values where the database's non-libc provider classifies
  characters differently from its `LC_CTYPE`.
- After `pg_upgrade` to PostgreSQL 19, rebuild indexes using `dmetaphone()`,
  `dmetaphone_alt()`, `soundex()`, `metaphone()`, or `difference()`.

## COPY, dumps, and changed runtime behavior

- PostgreSQL 19 fixes `standard_conforming_strings` at `on` and removes
  `escape_string_warning`. Regenerate older dumps made with the setting `off`
  using version 19 or later of `pg_dump` or `pg_dumpall`, or create the dumps
  with the setting enabled.
- Server-side `COPY FROM` treats `\.` in a CSV file as data. In psql scripts
  feeding CSV to `COPY FROM STDIN`, a line containing only `\.` still ends
  input. Check `\copy` scripts using older psql clients against an 18 server.
- PostgreSQL 19 rejects system-column references in `COPY FROM ... WHERE`.
  Rewrite affected filters to use ordinary columns.
- From 17.6, plain dump scripts can use `\restrict` to disable psql
  meta-commands while processing source-server data. Restore these scripts
  with a psql client supporting `\restrict`.
- From 17.8, a server error processing a received `NOTIFY` closes the listening
  connection. Reconnect, issue `LISTEN` again, and refresh application state if
  missed notifications could leave it stale.
- An `AFTER` trigger runs under the role active when its event was queued;
  deferred triggers retain that role even if the transaction changes roles.

## Maintenance and resource settings

- Maintenance operations such as `CREATE INDEX`, `REFRESH MATERIALIZED VIEW`,
  and `VACUUM` use a restricted `search_path`. Give functions called by
  expression indexes or materialized views an explicit path through trusted
  schemas if they need objects outside that path.
- Use `GRANT MAINTAIN ON TABLE app.events TO ops;` for one relation, or grant
  `pg_maintain` for maintenance across relations. It covers `VACUUM`, `ANALYZE`,
  `REINDEX`, `REFRESH MATERIALIZED VIEW`, `CLUSTER`, and `LOCK TABLE`.
- `VACUUM` and `ANALYZE` on a parent process inheritance children too. Use
  `ANALYZE ONLY public.events;` for the partitioned parent's statistics alone.
- `autovacuum_worker_slots` reserves capacity at server start;
  `autovacuum_max_workers` can change at runtime up to that count.
  `autovacuum_vacuum_max_threshold` caps the calculated dead-tuple threshold.
- Use `autovacuum_max_parallel_workers` for parallel index vacuuming by
  autovacuum. Autovacuum scores tables to determine their priority.
- Parallel `VACUUM` leaders and workers share `vacuum_cost_limit` when
  cost-based delay is enabled. Tune it for the operation as a whole.
- `REPACK (CONCURRENTLY) public.events;` reorganizes the table and reclaims
  disk space while keeping it available for reads and writes.
- PostgreSQL 19 defaults `max_locks_per_transaction` to 128. Double an explicit
  value carried from an older release to keep equivalent lock capacity under
  the new allocation scheme.
- JIT defaults to off. Set `jit = on` where query workloads benefit from it.

## Backup, statistics, and replication

- Enable `summarize_wal = on` and retain summaries with `wal_summary_keep_time`
  over the LSN range an incremental backup needs. Inspect ranges with
  `pg_available_wal_summaries()` and progress with `pg_get_wal_summarizer_state()`.
- `pg_combinebackup --link` can hard-link eligible input files into the output.
  Use the default mode when input and output backups must be usable independently.
- Use `pg_dump --statistics appdb` to include optimizer statistics, or
  `pg_dump --statistics-only appdb` to dump only statistics.
- `pg_upgrade` preserves ordinary optimizer statistics by default. Extended
  statistics still need `ANALYZE`. Opt out with `pg_upgrade --no-statistics`,
  or fill missing statistics afterward as a superuser with
  `vacuumdb --analyze-only --missing-stats-only appdb`.
- Mark failover subscriptions with `WITH (failover = true)` at creation, or
  pass `true` as the fifth argument to `pg_create_logical_replication_slot()`.
  Use `sync_replication_slots` or `pg_sync_replication_slots()` on the standby.
  On the publisher, `synchronized_standby_slots` holds logical delivery until
  specified physical slots confirm WAL.
- `pg_upgrade` can preserve valid publisher slots and subscriber state when
  the source cluster is already on 17 or later. Starting in 17.6, the target
  can use a nondefault `max_slot_wal_keep_size` during the upgrade.
- A server running with `wal_level = replica` can enable logical replication
  without restarting. PostgreSQL 19 can logically replicate sequence values.
- Use `WAIT` on a standby to wait for replay to reach the primary's write
  before reading the result.

## JSON results and error boundaries

- Query-fed `json_array` takes a single-column `SELECT` and always skips SQL
  `NULL` rows. The expression-list form offers `NULL ON NULL` or `ABSENT ON NULL`.
  In PostgreSQL 19, `SELECT json_array(SELECT 1 WHERE false);` returns `[]`;
  update callers that tested for SQL `NULL` on an empty result.
- `json_object` rejects SQL `NULL` keys. `WITH UNIQUE KEYS` rejects duplicate
  keys in the constructor; `IS JSON ... WITH UNIQUE KEYS` checks every object,
  including objects inside arrays.
- Use `@?` or `jsonb_path_exists` for paths emitting matching items, and `@@`
  or `jsonb_path_match` for predicates emitting one Boolean or null result.
  Even a false result counts as an item for an existence check.
- Lax paths unwrap arrays one level per evaluation step. Use `strict` for
  recursive descent without that implicit unwrapping.
- `JSON_EXISTS` defaults to `FALSE ON ERROR`. Errors casting the input document
  to `jsonb` propagate before the SQL/JSON query functions' `ON ERROR` clauses.
- `JSON_QUERY` defaults to `jsonb` without a wrapper; multiple matches trigger
  `ON ERROR`. `WITH WRAPPER` always wraps; `WITH CONDITIONAL WRAPPER` wraps
  multiple results. `OMIT QUOTES` requires an unwrapped result.
- `JSON_VALUE` requires a single scalar, removes string quotes, and defaults
  to `text` unless `RETURNING` is specified. JSON null becomes SQL `NULL` here
  and stays JSON null in `JSON_QUERY`.
- `JSON_TABLE` table-level `EMPTY ON ERROR` applies to the row path; columns
  have their own error clauses. Sibling `NESTED PATH` matches contribute
  separate rows with `NULL` in the other sibling's columns.

## Schema and SQL choices

- Include all partition-key columns in partitioned-table exclusion constraints
  and compare them for equality so conflicts land in the same partition.
- `CHECK` and foreign key constraints can be `NOT ENFORCED`: PostgreSQL records
  them without checking writes. Inspect `pg_constraint.conenforced`.
- Named `NOT NULL` constraints appear in `pg_constraint`. Add one with
  `NOT VALID` to check new writes immediately and validate existing rows separately.
- Stored generated columns can be explicitly listed in a publication, or
  included with `publish_generated_columns = 'stored'` for tables without a list.
- `uuidv7()` takes an optional `interval` offset for the embedded timestamp.
  `uuid_extract_timestamp(uuid)` returns `timestamp with time zone` for UUID
  versions 1 and 7, and `NULL` for others; accuracy depends on the generator.
- `LIKE` supports nondeterministic collations in PostgreSQL 18, allowing a
  case-insensitive ICU collation to apply to wildcard patterns.

## Monitoring and client interfaces

- In `pg_stat_io`, replace `op_bytes` with `read_bytes`, `write_bytes`, and
  `extend_bytes`. Move `wal_write`, `wal_sync`, `wal_write_time`, and
  `wal_sync_time` monitoring from `pg_stat_wal` to WAL rows in `pg_stat_io`,
  where `track_wal_io_timing` applies.
- In `pg_stat_subscription_stats`, replace `sync_error_count` with
  `sync_table_error_count`; sequence synchronization errors are tracked separately.
- Update wait-event matching: `BUFFERPIN` becomes `BUFFER`, `BufferPin` becomes
  `BufferCleanup`, and `BufferContent` is replaced by `BufferShared`,
  `BufferShareExclusive`, and `BufferExclusive`.
- Use `\startpipeline` to queue psql commands without waiting after each one,
  and `\endpipeline` to collect results and return to normal execution.
- `postgres_fdw` can use incoming SCRAM authentication with
  `use_scram_passthrough`, avoiding a stored user-mapping password. It passes
  transaction `READ ONLY` and `DEFERRABLE` status to remote sessions; a local
  `READ ONLY` transaction cannot modify remote rows through the foreign server.
- User-defined data type receive functions get length-delimited buffers that
  may lack a terminating NUL. Read by length or make a terminated copy before
  calling a C string API.
- Use static storage for the routine structure returned by an index access
  method handler; update handlers that allocate it dynamically.

Files in this skill

  • SKILL.md8.3 KB
  • coverage.json742 B
  • references/clients-and-cli.md4.8 KB
  • references/copy-backup-and-maintenance.md5.4 KB
  • references/extensions-and-fdw.md2.9 KB
  • references/json.md3.2 KB
  • references/migration-and-compatibility.md4.8 KB
  • references/observability-and-planning.md5.1 KB
  • references/replication-and-recovery.md2.3 KB
  • references/sql-and-schema.md6.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.