# Trigger Parameters

DevFeed: [Trigger Parameters](<https://devfeed.tech/articles/trigger-parameters-34516.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2013/08/trigger-parameters/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2013-08-23T10:08:00Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Code](<https://devfeed.tech/topics/code.md>), [Database](<https://devfeed.tech/topics/database.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [function](<https://devfeed.tech/tags/function.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>)

## AI overview

This tutorial explains how to build a reusable, parameterized PostgreSQL trigger with PL/pgSQL and the hstore extension. The trigger is designed to compute and maintain a value such as a duration while accommodating different column names across tables.

## Source excerpt

Sometimes you want to compute values automatically at INSERT time, like for example a duration column out of a start and an end column, both timestamptz. It's easy enough to do with a BEFORE TRIGGER on your table. What's more complex is to come up with a parametrized spelling of the trigger, where you can attach the same stored procedure to any table even when the column names are different from one another.