I think this is unlikely to work reliably: + PG_TRY(); + { + ExtensionControl *control = read_extension_control_file(extname); + + if (control) + { + ereport(ERROR, + (errcode(ERRCODE_DUPLICATE_OBJECT), + errmsg("extension \"%s\" is already available", extname))); + } + } + PG_CATCH(); + { + /* no control file found is good news for us */ + } + PG_END_TRY();
What if read_extension_control_file() fails because of an out-of-memory error? I think you need to extend that function to have a more useful API, not rely on it raising a specific error. There is at least one more case when you're calling that function in the same way. It'd probably work to have a boolean return (found/not found), and return the ExtensionControl structure through a pointer. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers