Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id BA5E79F9F46 for ; Thu, 28 Dec 2006 13:51:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 36371-05 for ; Thu, 28 Dec 2006 13:50:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from fafnir.androme.com (fafnir.androme.com [62.58.96.158]) by postgresql.org (Postfix) with ESMTP id 3C8AE9FA097 for ; Thu, 28 Dec 2006 13:51:01 -0400 (AST) Received: by fafnir.androme.com (Postfix, from userid 1003) id 38462B982EB; Thu, 28 Dec 2006 18:51:00 +0100 (CET) Message-ID: <45940403.4010909@andromeiberica.com> Date: Thu, 28 Dec 2006 18:50:59 +0100 From: Arnau Reply-To: arnaulist@andromeiberica.com User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: help with version checking References: <000001c72aa7$e705f1e0$0b00a8c0@tedy> In-Reply-To: <000001c72aa7$e705f1e0$0b00a8c0@tedy> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/178 X-Sequence-Number: 27134 Hi Daniel, > You should define a PL/PGSQL function such as: > > CREATE OR REPLACE FUNCTION check_version() > RETURNS void > AS $$ > DECLARE > v_version VARCHAR; > BEGIN > SELECT version INTO v_version FROM version WHERE id = 1; > > IF v_version <> '1.0.0.0' THEN > RAISE EXCEPTION 'This script needs Agenda version 1.0.0.0, detected > version %', v_version; > END IF; > END; > $$ LANGUAGE PLPGSQL; I don't want, if it's possible, to create a function. I just want to check a value stored in a table and if doesn't match the expected one then abort the script execution. -- Arnau