rework attempt_cast function
authorGalen Charlton <gmc@esilibrary.com>
Wed, 26 Dec 2012 17:00:32 +0000 (12:00 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 26 Dec 2012 17:00:32 +0000 (12:00 -0500)
commit62ae8fc257b7637ba3d378ca21ff61a674bf2553
tree896b3e8d12f2d55aa56637ad0903c6ab0b308851
parent6a1a598c8c88e4cfa1187a4e8ee02a494c4f576b
rework attempt_cast function

This function now returns the original value if it can
be cast to the desired type, and NULL otherwise.  For example:

UPDATE foo
SET price = migration_tools.attempt_cast(l_price, 'NUMERIC(8,2)')::NUMERIC(8,2);

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
sql/base/base.sql