postgresql

Provides PostgreSQL documentation for SQL queries, database design, administration, and performance tuning.

3|1|Updated Nov 30, 2025
One-click install
npx skills add https://github.com/PALabs-v1/AI_friend --skill postgresql-palabs-v1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgresql
Source: https://github.com/PALabs-v1/AI_friend/tree/main/.agents/skills/postgresql
Command: npx skills add https://github.com/PALabs-v1/AI_friend --skill postgresql-palabs-v1

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Working with PostgreSQL often requires looking up exact syntax, connection parameters, configuration options, and administration details scattered across hundreds of official documentation pages. This Skill consolidates that official documentation into an on-demand reference so you get accurate answers about SQL, libpq, indexing, and server management without leaving your workflow. ## Core Features & Use Cases - SQL and Query Reference: Covers aggregate functions, WHERE vs HAVING semantics, FILTER clauses, table inheritance, and indexing strategies drawn from the official PostgreSQL 18 docs. - Connection and Client Library Guidance: Details libpq connection functions (PQconnectdb, PQconnectStart/PQconnectPoll), connection string formats, URIs, multi-host failover, and parameter keywords. - Administration and Installation: Includes binary and source installation steps, platform-specific notes for macOS, Windows, and Solaris, and post-installation environment setup. - Use Case: When writing a query that needs per-aggregate filtering, consult the references to apply the FILTER clause correctly instead of misusing aggregates in a WHERE clause. ## Quick Start Ask how to write a PostgreSQL query using aggregate functions with GROUP BY and HAVING, and request the relevant official documentation details.

Frequently Asked Questions about postgresql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use aggregate functions with GROUP BY in PostgreSQL?

Aggregate functions like count, sum, avg, max, and min compute a single result from multiple rows, and GROUP BY produces one result row per group. Use HAVING to filter grouped rows, since WHERE is evaluated before aggregation and cannot contain aggregates.

How to connect to PostgreSQL using libpq connection strings?

libpq accepts keyword/value strings like host=localhost port=5432 dbname=mydb, or URIs such as postgresql://user:secret@localhost/mydb. Use PQconnectdbParams or PQconnectdb to open the connection, and check PQstatus before sending queries.

Does PostgreSQL support connecting to multiple hosts for failover?

Yes, both keyword/value strings and URIs accept comma-separated host lists, optionally with matching port lists. Each host is tried in order until a connection succeeds, though remaining hosts are skipped if authentication fails.

Why can't I use an aggregate function in a WHERE clause?

WHERE selects input rows before groups and aggregates are computed, so aggregates are not yet available at that stage. Move the condition to HAVING, use a subquery, or apply the per-aggregate FILTER clause instead.

What are the limitations of table inheritance in PostgreSQL?

Table inheritance lets a child table include all columns of its parent, and queries on the parent include child rows unless ONLY is specified. However, inheritance is not integrated with unique constraints or foreign keys, which limits its usefulness.

When should I build PostgreSQL from source instead of using binaries?

Binary packages are recommended for most users and are available for common operating systems. Building from source is intended for people developing PostgreSQL itself or writing extensions, and requires platform-specific tools such as Bison, Flex, and a C compiler.