Received: from titan.dialogue.net (IDENT:root@[212.56.104.250]) by hub.org (8.9.3/8.9.3) with ESMTP id GAA90181 for ; Wed, 16 Feb 2000 06:04:45 -0500 (EST) (envelope-from robin@dialogue.co.uk) Received: from roadrunner.dialogue.net (roadrunner.dialogue.net [192.168.2.14]) by titan.dialogue.net (8.9.3/8.9.1) with ESMTP id LAA07616 for ; Wed, 16 Feb 2000 11:04:15 GMT Received: by roadrunner.dialogue.net with Internet Mail Service (5.5.1960.3) id <10K55H7A>; Wed, 16 Feb 2000 11:08:29 -0000 Message-ID: <31262893C5E5D2119C4900105A30B3A112D593@roadrunner.dialogue.net> From: Robin Keech To: "'pgsql-sql@postgresql.org'" Subject: Auto increment field when updating? Date: Wed, 16 Feb 2000 11:08:28 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.1960.3) Content-Type: text/plain Hi, hope you can help. This may be a really stupid question, but here goes.... I have a table called 'log'. This keeps track of an ongoing process. The process writes records to the 'log' table using a unique id. If the id does not exist then the process inserts, else it updates the existing row. Only some fields are written to each time the row is updated. There is one field called 'count' that ONLY needs to increment every time that particular row AND the field 'count' are updated. I know that I can select the information, increment it and update it back again, but is there any way of setting up the database to do this automatically? I am using PostgreSQL 6.5. Thanks