Add a test case for exception handling.

Per request from Regina Obe.
Move GetGlobalContext out of CompileFunction.

GetGlobalContext calls the startup procedure, and if the very first operation
is CREATE FUNCTION of this, before creating V8 Function we recursively call
Compile and plv8_get_proc, which throws prosrc away as cache->function is not
ready.  CompileFunction is still grabbing this stale pointer and after the
global context initialized it then start compiling this JS function, which
causes the issue.  By taking out the global context initialization from
CompileFunction, the cache pointers are refreshed before entring
CompileFunction.  An alternative could be to check if the function is already
created after calling GetGlobalContext, but this function is suuposed to not
interact with cache.

Reported by Christian Passet in issue #76.
Smoke all postgresql versions