Difference between revisions of "CREATE EXTENSION"
Jump to navigation
Jump to search
(20 intermediate revisions by 3 users not shown) | |||
Line 6: | Line 6: | ||
[ CASCADE ] | [ CASCADE ] | ||
+ | * <code>CASCADE</code> Automatically install any extensions that this extension depends on that are not already installed. Their dependencies are likewise automatically installed, recursively. The SCHEMA clause, if given, applies to all extensions that get installed this way. Other options of the statement are not applied to automatically-installed extensions; in particular, their default versions are always selected. | ||
− | + | == Examples == | |
− | + | {{CREATE EXTENSION TOC}} | |
− | [[ | + | |
+ | create extension WRONG_NAME; | ||
+ | ERROR: extension "wrong_name" is not available | ||
+ | DETAIL: Could not open extension control file "[[/Users/user/brew/share/postgresql@17/extension/]]wrong_name.control": No such | ||
+ | file or directory. | ||
+ | HINT: The extension must first be installed on the system where PostgreSQL is running. | ||
== Related == | == Related == | ||
* [[PostgreSQL extension]]s | * [[PostgreSQL extension]]s | ||
− | * [[SELECT * FROM pg_extension;]] | + | * <code>[[SELECT * FROM pg_extension;]]</code> |
+ | * [[plpgsql]] | ||
== See also == | == See also == | ||
+ | * {{create extension}} | ||
* {{PostgreSQL extensions}} | * {{PostgreSQL extensions}} | ||
[[Category:PostgreSQL]] | [[Category:PostgreSQL]] |
Latest revision as of 08:36, 20 January 2025
CREATE EXTENSION [ IF NOT EXISTS ] extension_name [ WITH ] [ SCHEMA schema_name ] [ VERSION version ] [ CASCADE ]
CASCADE
Automatically install any extensions that this extension depends on that are not already installed. Their dependencies are likewise automatically installed, recursively. The SCHEMA clause, if given, applies to all extensions that get installed this way. Other options of the statement are not applied to automatically-installed extensions; in particular, their default versions are always selected.
Examples[edit]
CREATE EXTENSION pg_stat_statements;
create extension pg_trgm;
create extension btree_gist;
create extension postgres_fdw;
CREATE EXTENSION uuid-ossp;
CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA public;
CREATE EXTENSION IF NOT EXISTS timescaledb;
(TimescaleDB installation)CREATE EXTENSION postgis;
create extension WRONG_NAME; ERROR: extension "wrong_name" is not available DETAIL: Could not open extension control file "/Users/user/brew/share/postgresql@17/extension/wrong_name.control": No such file or directory. HINT: The extension must first be installed on the system where PostgreSQL is running.
Related[edit]
See also[edit]
Advertising: