redshift-guide

Generates correct Amazon Redshift SQL, DDL, COPY/UNLOAD, and Data API patterns by correcting PostgreSQL-derived mistakes.

2.5k|282|Updated Apr 23, 2026
One-click install
npx skills add https://github.com/aws/agent-toolkit-for-aws --skill redshift-guide
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: redshift-guide
Source: https://github.com/aws/agent-toolkit-for-aws/tree/main/plugins/aws-data-analytics/skills/redshift-guide
Command: npx skills add https://github.com/aws/agent-toolkit-for-aws --skill redshift-guide

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

LLMs frequently generate PostgreSQL syntax that fails or silently misbehaves on Amazon Redshift — such as CREATE INDEX, string_agg, SERIAL, pg_catalog queries, or stl_* system views — because Redshift only shares PostgreSQL's wire protocol, not its behavior. This Skill corrects those assumptions and provides verified Redshift-specific SQL, DDL, and operational guidance.

Core Features & Use Cases

  • PostgreSQL-to-Redshift correction: Maps wrong patterns to correct ones (LISTAGG instead of string_agg, IDENTITY instead of SERIAL, MERGE instead of ON CONFLICT, SYS_* views instead of STL_*).
  • DDL and data movement: Covers CREATE TABLE with DISTKEY/SORTKEY/ENCODE, COPY from S3 with IAM_ROLE and error handling, UNLOAD with KMS encryption, and Iceberg tables via USING ICEBERG.
  • Metadata and troubleshooting: SHOW-command-first discovery, SYS_/SVV_ system view selection by deployment type, permission-denied diagnostics, and "relation does not exist" resolution flows.
  • Use Case: A user asks why their COPY job failed on a Redshift Serverless workgroup. The Skill routes to the Data API recipe, runs a bounded long-polling loop, and queries sys_load_error_detail for row-level diagnostics.

Quick Start

Ask the agent to write a Redshift CREATE TABLE statement with proper distribution and sort keys, or to debug a failing COPY command on your Serverless workgroup.

Frequently Asked Questions about redshift-guide

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

FAQPage Schema
How do I write SQL for Amazon Redshift instead of PostgreSQL?

Redshift shares PostgreSQL's wire protocol but diverges significantly: use LISTAGG instead of string_agg, IDENTITY instead of SERIAL, MERGE instead of ON CONFLICT, and SORTKEY instead of CREATE INDEX. Assume divergence and verify against Redshift-specific references rather than answering from PostgreSQL habit.

How do I load data from S3 into Redshift with COPY?

Use COPY with the IAM_ROLE attached to the cluster or namespace, specifying the format (CSV, PARQUET, JSON) and options like MAXERROR for error tolerance. Debug failures with sys_load_error_detail, which works on all deployment types, unlike stl_load_errors.

Does Redshift Serverless support stl_ and stv_ system views?

No. STL_, STV_, SVL_, and SVCS_ views are provisioned single-AZ only and absent on Serverless and Multi-AZ. Use SYS_* views such as sys_query_history and sys_load_error_detail, which work on every deployment type.

Why does my Redshift query say relation does not exist?

The object usually exists in a different schema than your search_path. Confirm location with SHOW TABLES or svv_all_tables, check SHOW search_path, then fully qualify as schema.table. External and datashare schemas always require explicit qualification.

How do I use the Redshift Data API for async queries?

Call execute-statement with --workgroup-name (Serverless) or --cluster-identifier (provisioned), using WaitTimeSeconds for long polling inside a bounded loop. Note that GetStatementResult raises ResourceNotFoundException when results are not ready yet, which means retry, not failure.

When should I not use this Redshift guidance?

This guidance applies only to Amazon Redshift itself. For Aurora, RDS, DynamoDB, or standalone Athena and Glue work, defer to those services' own documentation, though S3 and Glue remain in scope for Redshift COPY, UNLOAD, and Spectrum external tables.