From a09dbe656fda90a77c36fd3093f99e7f26f4f480 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Wed, 22 Apr 2009 23:17:57 +0000 Subject: [PATCH 1/1] protection from overflow --- sql/base/base.sql | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/sql/base/base.sql b/sql/base/base.sql index 8141a3b..0c4cb15 100644 --- a/sql/base/base.sql +++ b/sql/base/base.sql @@ -227,7 +227,7 @@ CREATE OR REPLACE FUNCTION migration_tools.rebarcode (o TEXT, t BIGINT) RETURNS DECLARE n TEXT := o; BEGIN - IF o ~ E'^\\d+$' AND o !~ E'^0' THEN + IF o ~ E'^\\d+$' AND o !~ E'^0' AND length(o) < 19 THEN -- for reference, the max value for a bigint is 9223372036854775807. May also want to consider the case where folks want to add prefixes to non-numeric barcodes IF o::BIGINT < t THEN n = o::BIGINT + t; END IF; -- 1.7.2.5