Difference between revisions of "CREATE EXTENSION"

From wikieduonline
Jump to navigation Jump to search
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
* https://www.postgresql.org/docs/current/sql-createextension.html
 +
 
  [[CREATE]] [[EXTENSION]] [ IF NOT EXISTS ] extension_name
 
  [[CREATE]] [[EXTENSION]] [ IF NOT EXISTS ] extension_name
 
     [ WITH ] [ SCHEMA schema_name ]
 
     [ WITH ] [ SCHEMA schema_name ]
Line 4: 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.
  
[[CREATE]] EXTENSION [[pg_stat_statements]];
+
== Examples ==
CREATE EXTENSION [[IF NOT EXISTS]] [[pg_stat_statements]] WITH [[SCHEMA]] public;
+
* <code>[[CREATE EXTENSION pg_stat_statements]];</code>
 +
* <code>create extension [[pg_trgm]];</code>
 +
* <code>create extension [[btree_gist]];</code>
 +
* <code>create extension [[postgres_fdw]];</code>
 +
* <code>CREATE EXTENSION [[IF NOT EXISTS]] [[pg_stat_statements]] WITH [[SCHEMA]] public;</code>
 +
* <code>[[CREATE EXTENSION uuid-ossp]];</code>
 +
* <code>[[CREATE EXTENSION IF NOT EXISTS timescaledb]];</code> ([[TimescaleDB installation]])
  
CREATE EXTENSION [[uuid-ossp]];
+
== Related ==
 +
* [[PostgreSQL extension]]s
 +
* <code>[[SELECT * FROM pg_extension;]]</code>
  
 
== See also ==
 
== See also ==
* {{PostgreSQL}}
+
* {{PostgreSQL extensions}}
  
 
[[Category:PostgreSQL]]
 
[[Category:PostgreSQL]]

Latest revision as of 07:39, 13 July 2023

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]

Related[edit]

See also[edit]

Advertising: