Create (function, procedure) and trigger to increment a counter

From: Chris Barnes <compuguruchrisbarnes(at)hotmail(dot)com>
To: Postgres General Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Create (function, procedure) and trigger to increment a counter
Date: 2009-07-16 14:25:07
Message-ID: BLU149-W316D7A71AC7A2E19B17CF5D4210@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I have a table usage, I would like to create a (function or procedure) called by the trigger to increment column counter after an update.

Can someone lend me a hand with the process behind creating this function,procedure and trigger.

Table "public.usage"
Column | Type | Modifiers
---------------+-----------------------+-----------
instrument | character varying(13) |
date | date |
counter | integer |

_________________________________________________________________
Internet explorer 8 lets you browse the web faster.
http://go.microsoft.com/?linkid=9655582

Browse pgsql-general by date

  From Date Subject
Next Message Yuriy Rusinov 2009-07-16 14:59:09 Re: Please help
Previous Message Florian Weimer 2009-07-16 14:13:49 Re: Working around spurious unique constraint errors due to SERIALIZABLE bug