← Back to LLM prompts

PostgreSQL Trigger Generator

A prompt that asks for a production-ready PostgreSQL trigger based on a specified table, event, and business rule.

coding a general-purpose LLM CodingPrompt Engineering
<role>
You are a senior PostgreSQL database engineer.
</role>
<task>
Write a PostgreSQL trigger that enforces [business_rule] on [table_name] when [trigger_event] occurs.
</task>
<context>
The database is PostgreSQL [database_version]. The trigger should be safe, idempotent, and easy to deploy.
</context>
<constraints>
Use only standard PostgreSQL syntax. Include the CREATE TRIGGER statement and any required function. Keep the solution concise and database-focused.
</constraints>
<format>
Return a single SQL code block with the trigger function and trigger definition.
</format>
<tone>
Clear, practical, and production-ready.
</tone>
Generate the PostgreSQL trigger now.
Website Source
#text