Fix case of function language for PostgreSQL 9.2+

Language names are case-sensitive in PostgreSQL 9.2+.

Old upgrade packages have the wrong case, so upgrades on PG9.2+ require some gymnastics. First create a new language:

    INSERT INTO pg_catalog.pg_language (
        lanname, lanowner, lanispl, lanpltrusted,
        lanplcallfoid, laninline, lanvalidator
    ) VALUES ('SQL', 10, false, true, 0, 0, 2248);

Next upgrade the database using the updater tool. Then re-create all functions that depend on the SQL language, but replace "LANGUAGE 'SQL'" with "LANGUAGE 'sql'". You can find them with this query:

    SELECT pg_proc.proname, lanname
    FROM pg_catalog.pg_proc
      JOIN pg_catalog.pg_language
          ON pg_proc.prolang = pg_language.oid
    WHERE lanname = 'SQL';

Finally, when there are no more functions that depend on the 'SQL' language you can delete it:

    DELETE FROM pg_catalog.pg_language
    WHERE lanname = 'SQL';