PostgreSQL
Database Database & StorageInstall Command
npx clawhub@latest install postgresql
Installation Guide
Make sure Node.js 22+ and OpenClaw are installed. Run openclaw --version in your terminal to verify.
Run the install command above in your terminal. ClawHub will automatically download and install PostgreSQL to the ~/.openclaw/skills/ directory.
Run openclaw skills list to check your installed skills and confirm PostgreSQL appears in the list.
Follow the configuration instructions in the description below to add skill settings to ~/.config/openclaw/openclaw.json5.
~/.openclaw/skills/ or the skills/ directory in your project root. Make sure the folder contains a SKILL.md file.
Detailed Description
The PostgreSQL skill lets OpenClaw connect directly to your PostgreSQL database, querying data and managing it with natural language.
Core Features
- Natural Language to SQL: Describe your query requirements in plain language, and SQL is automatically generated and executed
- Schema Analysis: View database table structures, field types, and indexes
- Data Queries: Execute SELECT queries with formatted result display
- Report Generation: Generate statistical reports based on query results
- Safe Mode: Configurable read-only mode to prevent accidental modifications
Configuration
{
skills: {
postgresql: {
host: "localhost",
port: 5432,
database: "mydb",
user: "readonly_user",
password: "xxx",
readOnly: true
}
}
}
Use Cases
- "How many new users registered last month?"
- "What does the structure of the orders table look like?"
- "Show total sales by region this year, sorted from highest to lowest"
- "Find active users who haven't logged in during the past 7 days"
Security Recommendations
It is strongly recommended to connect using a read-only database user to prevent the AI from accidentally executing DELETE, UPDATE, or DROP operations. For production databases, connect via a read replica.