Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: help with version checking


  • From: Arnau <arnaulist(at)andromeiberica(dot)com>
  • To: pgsql-sql(at)postgresql(dot)org
  • Subject: Re: help with version checking
  • Date: Thu, 28 Dec 2006 18:50:59 +0100
  • Message-id: <45940403(dot)4010909(at)andromeiberica(dot)com>

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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group