HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Ignore a particular column on update trigger

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
ignoretriggerupdatecolumnparticular

Problem

I have a PostgreSQL table with 15 columns. I have an on update trigger on it. I'd like to exclude column10 from it. Meaning when there is any update on column10 only then there should not be any action other than it. If full update or any other column update, trigger should fire as normal.

I don't seem to find any easy way to do this. Can someone suggest please?

Solution

Documentation shows that you can define specific columns in an on update trigger:

create trigger foo
after update of column1, column2, ... -- other columns, except column10
on your_table ...

Code Snippets

create trigger foo
after update of column1, column2, ... -- other columns, except column10
on your_table ...

Context

StackExchange Database Administrators Q#254379, answer score: 4

Revisions (0)

No revisions yet.