Database Reference
In-Depth Information
The user can modify the deinition of an extension member object by utilizing the
feature of a superseding command for member objects. The extension in addition
has a procedure for packaging the modiied SQL objects contained in an extension.
Consider this example; if the second version of an extension integrates one function
and changes the body of another function compared to the irst version, then the
extension owner can provide an updated script that makes just those two changes.
The user can utilize the ALTER EXTENSION command to apply these changes and
track which version of the extension is authentically installed in a given database.
Extensions can have different types of PostgreSQL objects like functions and tables,
but the database, table space and roles cannot be part of the extension. Extensions are
valid only within the database in which they are created. A table can be a member
of an extension, but indexes on tables are not considered members of the extension.
Another thing to keep in mind is that schemas can belong to extensions, but
extensions cannot belong to schemas because an extension does not subsist within
any schema. The extension's member objects, however, will belong to schemas
whenever appropriate for their object types. It may or may not be appropriate for an
extension to own the schema its member objects are within.
There are many advantages of the extensions, and a few of them are extensively
repeatability and extension update. The user can update the extension easily as
PostgreSQL provides an easy way to manage updates to the SQL commands that
deine an extension object. Updates can be performed by giving a version name
for each version of the extension's install script. On the other hand, if users want to
update databases dynamically from one version to the next version, then the user
should utilize the update scripts that make the essential changes to go from one
version to the next. The update scripts have names with the following pattern:
extension--oldversion--newversion.sql
The following is an example of the preceding pattern:
tempext--1.0--1.1.sql
The preceding SQL ile contains the SQL commands to change the temp extension
from 1.0 to 1.1 . When an updated script is available, the user/developer can use the
following command:
ALTER EXTENSION UPDATE
This command will update an installed extension to the speciic revision. The ALTER
EXTENSION command can execute sequences of update script iles to perform a
requested update. For example, if only tempext--1.0--1.1.sql and tempext--1.1-
-2.0.sql are available, then the ALTER EXTENSION command will be applied to them
in sequence if an update to version 2.0 is requested when 1.0 is currently installed.
 
Search WWH ::




Custom Search