Where is that decode function defined? I have a fresh install of the 4.6 branch, and I don't have a decode function that matches that function signature:
dotlrn=# select decode(count(*),0,0,1) from secret_tokens;
ERROR: Function 'decode(int8, int4, int4, int4)' does not exist
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts
dotlrn=# select version();
version
------------------------------------------------------------------
PostgreSQL 7.2.1 on sparc-sun-solaris2.8, compiled by GCC 2.95.3
(1 row)
dotlrn=#