Loading topic
INSERT, UPDATE, DELETE, and TRUNCATE. The trigger runs inside the same transaction as the event, so an error in the trigger can abort the change.2 min readSELECT, INSERT, UPDATE, and DELETE, can create tables, and understand transactions. Familiarity with simple PL/pgSQL blocks is helpful.1 min readINSERT, UPDATE, DELETE, transactions, and simple PL/pgSQL. This chapter focuses on trigger timing: when PostgreSQL runs a trigger relative to the data change.2 min readINSERT, UPDATE, DELETE, and transactions. This chapter focuses on how often PostgreSQL runs a trigger.1 min readINSERT, UPDATE, DELETE, CREATE TABLE, transactions, and simple PL/pgSQL. This chapter focuses on deciding when a trigger should run, not on writing complex trigger functions.2 min readINSERT, UPDATE, and DELETE, PostgreSQL transactions, and simple PL/pgSQL syntax. This chapter assumes you already know how to create a trigger function and attach it with CREATE TRIGGER.1 min readINSERT, UPDATE, DELETE, transactions, and simple PL/pgSQL. In PostgreSQL, a trigger function returns a value of type trigger. That value tells PostgreSQL whether to continue the operation and, for some triggers, which row to use.1 min readCREATE TABLE, INSERT, and UPDATE statements, and that you understand transactions. This example uses PL/pgSQL, PostgreSQL’s procedural language.1 min readINSERT, UPDATE, and CREATE TABLE syntax, transactions, and simple PL/pgSQL blocks. This chapter uses a row-level BEFORE trigger to reject invalid account balances.1 min readINSERT, UPDATE, DELETE, basic transactions, and simple PL/pgSQL. An audit trail is a history of changes to data. It can answer questions such as who changed an account, which operation occurred, and what the row contained before and after the change.1 min readCREATE VIEW, INSERT, and PL/pgSQL syntax. You should also understand that a transaction either commits all its changes or rolls them back.1 min readDELETE and INSERT statements, understand transactions, and can read simple PL/pgSQL. A trigger is database logic that runs automatically when a table event occurs.2 min readINSERT, UPDATE, and CREATE TABLE syntax, familiarity with PostgreSQL clients, and a basic understanding of transactions.2 min readaccounts_audit_trg already exists. Trigger management changes database behavior, so inspect the current definition before changing it.2 min readBEFORE and AFTER triggers. It also assumes that you can read simple PL/pgSQL functions.2 min readBEGIN, IF, and RAISE. A regular trigger reacts to changes in table data. An event trigger reacts to data definition language (DDL) commands, such as CREATE TABLE, ALTER TABLE, and `DROP TABL2 min read