Received: from fw.mccons.net (adsl-65-64-105-41.dsl.kscymo.swbell.net [65.64.105.41]) by postgresql.org (Postfix) with ESMTP id 5AF0E47693B for ; Fri, 12 Apr 2002 03:02:34 -0400 (EDT) Received: (from root@localhost) by fw.mccons.net (8.11.3/8.11.4) id g3C72YT19771 for pgsql-admin@postgresql.org; Fri, 12 Apr 2002 02:02:34 -0500 (CDT) (envelope-from bmccane@mccons.net) Received: from localhost (localhost [127.0.0.1]) by fw.mccons.net (8.11.3/8.11.4av) with ESMTP id g3C72Uj19716 for ; Fri, 12 Apr 2002 02:02:30 -0500 (CDT) (envelope-from bmccane@mccons.net) Date: Fri, 12 Apr 2002 02:02:29 -0500 (CDT) From: Brian McCane To: pgsql-admin Subject: ALTER TABLE ... SET DEFAULT In-Reply-To: <22765.1018562543@sss.pgh.pa.us> Message-ID: <20020412015602.S18686-100000@fw.mccons.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS perl-11 X-Razor-Spam-ID: 277dd167105dffa9ce99e91fb4f8d5cfaeaf2fe1 X-Archive-Number: 200204/96 X-Sequence-Number: 3984 I have a field called 'updated' of type 'integer' in a table. I have created a function called 'since_epoch' which is declared with iscacheable and returns the value of 'extract(epoch from now())'. I want to make 'updated' have a default of 'since_epoch()'. I cannot get it to work with the following command: alter table foo alter column updated set default 'since_epoch()' ; this gets the error: ERROR: pg_atoi: error in "since_epoch()": can't parse "since_epoch()" I tried using 'since_epoch()::integer', but that failed as well. Is it possible to make the default value of an integer field use a function similar to how we use 'now()' for date and timestamp fields? - brian Wm. Brian McCane | Life is full of doors that won't open Search http://recall.maxbaud.net/ | when you knock, equally spaced amid those Usenet http://freenews.maxbaud.net/ | that open when you don't want them to. Auction http://www.sellit-here.com/ | - Roger Zelazny "Blood of Amber"