When creating an extension that is shipped to the PostgreSQL installer, users uses the CREATE EXTENSION
command as follows:
CREATE EXTENSION [IF NOT EXISTS] extension_name [WITH] [SCHEMA schema_name] [Version] [FROM old_version]
When the user calls the CREATE EXTENSION
command, it will load a specified extension into the current database. There must not be an extension of the same name already loaded. If an extension with the same name is already loaded, the user will get an error. In the backend, when the user calls the LOAD EXTENSION
command, the extension script file will be executed. The script will create initial SQL objects that are mainly functions, data types, operators, and indexes. The CREATE EXTENSION
command, in addition, notes down the identities of all the created objects so that they can be dropped again later, if the user executes the DROP EXTENSION
command. Only superusers or users who have database owner privileges can create or drop an extension...