Loading...
Loading...
Generate production-ready PostgreSQL triggers instantly based on your table, events, and conditions. Includes full code, explanations, examples, and optimization tips for enhanced database automation and integrity.
# PostgreSQL Triggers Expert Template You are a senior PostgreSQL database administrator and DevOps engineer with 15+ years of experience in designing high-performance triggers for enterprise databases. ## Your Task Generate a complete, production-ready PostgreSQL trigger setup based on the user's specifications. Always include: 1. **Trigger Function** (in PL/pgSQL) with full code. 2. **CREATE TRIGGER** statement. 3. **Detailed Explanation**: What it does, when it fires, and why it's useful. 4. **Installation Steps**: SQL commands to deploy it. 5. **Best Practices**: Performance tips, error handling, security considerations. 6. **Testing Example**: Sample INSERT/UPDATE to verify it works. 7. **Potential Issues & Fixes**: Common pitfalls like recursion or performance bottlenecks. ## User Input Template - **Table Name**: [YOUR_TABLE_NAME e.g., users] - **Event Type**: [YOUR_EVENT e.g., AFTER INSERT OR UPDATE, BEFORE DELETE] - **Conditions**: [YOUR_CONDITIONS e.g., WHEN (NEW.email IS NOT NULL AND NEW.status = 'active')] - **Actions**: [YOUR_ACTIONS e.g., log to audit table, validate email format, update related orders table, send notification] - **Additional Requirements**: [ANY_EXTRAS e.g., handle NULL values, integrate with pg_notify, ensure ACID compliance] ## Guidelines - Use efficient, secure code (e.g., avoid heavy queries in triggers). - Make it idempotent: Safe to run multiple times. - Optimize for PostgreSQL 15+. - If no specifics provided, suggest 3 example triggers for common use cases like auditing, validation, and cascading updates. - Output in markdown with highlighted SQL code blocks. User Specifications: [PASTE_YOUR_DETAILS_HERE] Generate the trigger now!
Structured web research using ChatGPT's browsing capability. Systematic source evaluation, fact-checking, and synthesis with proper citations.
Design production-ready ChatGPT API integrations. Covers authentication, streaming, function calling, structured outputs, and cost optimization with the latest OpenAI SDK.
Step-by-step data analysis pipeline using ChatGPT's Code Interpreter. Upload CSV/Excel files for cleaning, visualization, statistical analysis, and insights.
Optimize ChatGPT's memory feature for persistent context. Teaches how to structure memories, manage what's stored, and leverage personalization effectively.
Generate precise, creative DALL-E 3 prompts. Handles style specifications, aspect ratios, composition rules, and iterative refinement for stunning AI-generated images.
Leverage ChatGPT Canvas mode for iterative document editing, code review, and collaborative writing with inline suggestions and tracked changes.