From 9255a49fb5770c2cbcb8dc0b3de99ea703d20363 Mon Sep 17 00:00:00 2001 From: Syfaro Date: Sun, 22 Aug 2021 01:22:46 -0400 Subject: [PATCH] Add missing isnumeric function migration. --- migrations/20210822052026_isnumeric_function.down.sql | 1 + migrations/20210822052026_isnumeric_function.up.sql | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 migrations/20210822052026_isnumeric_function.down.sql create mode 100644 migrations/20210822052026_isnumeric_function.up.sql diff --git a/migrations/20210822052026_isnumeric_function.down.sql b/migrations/20210822052026_isnumeric_function.down.sql new file mode 100644 index 0000000..ea1e4a0 --- /dev/null +++ b/migrations/20210822052026_isnumeric_function.down.sql @@ -0,0 +1 @@ +DROP FUNCTION IF EXISTS isnumeric; diff --git a/migrations/20210822052026_isnumeric_function.up.sql b/migrations/20210822052026_isnumeric_function.up.sql new file mode 100644 index 0000000..cb0e2a6 --- /dev/null +++ b/migrations/20210822052026_isnumeric_function.up.sql @@ -0,0 +1,11 @@ +CREATE OR REPLACE FUNCTION isnumeric(text) RETURNS BOOLEAN AS $$ +DECLARE x NUMERIC; +BEGIN + x = $1::NUMERIC; + RETURN TRUE; +EXCEPTION WHEN others THEN + RETURN FALSE; +END; +$$ +STRICT +LANGUAGE plpgsql IMMUTABLE;