In PostgreSQL, plugins can include a SQL script that creates any database objects that the plugin depends on. If you install the plugin with CREATE EXTENSION, then PostgreSQL will automatically execute the plugin's SQL script:
CREATE EXTENSION loads a new extension into the current database. There must not be an extension of the same name already loaded.
Loading an extension essentially amounts to running the extension's script file. The script will typically create new SQL objects such as functions, data types, operators and index support methods. CREATE EXTENSION additionally records the identities of all the created objects, so that they can be dropped again if DROP EXTENSION is issued.
Loading an extension requires the same privileges that would be required to create its component objects. For most extensions this means superuser or database owner privileges are needed. The user who runs CREATE EXTENSION becomes the owner of the extension for purposes of later privilege checks, as well as the owner of any objects created by the extension's script.
It would be useful if we could build similar functionality on top of INSTALL PLUGIN/INSTALL SONAME, and maybe even --plugin-load/--plugin-load-add.
One case where it would be extremely useful is with Spider. Spider users currently have to manually run install_spider.sql to install the plugin and create all dependent objects.