Quantcast
Channel: Apply postgreSQL trigger to existing rows in database - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Fast Engy for Apply postgreSQL trigger to existing rows in database

$
0
0

Normally triggers would run on a table on BEFORE or AFTER an insert, update or delete of a row. There are several options that allow you to decide on when to call the trigger.

Updating the row currently being inserted before insert would be a typical way to use a trigger. Then it is just a matter of creating a trigger on the actual table:

CREATE TRIGGER trig_title_upweight_trigger
  BEFORE INSERT OR UPDATE
  ON pg_rocks_post
  FOR EACH ROW
  EXECUTE PROCEDURE title_upweight_trigger();

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>