Use security-definer functions to add records to the extension table

This allows an unpriveleged user to use the extensions on tables he
owns.