diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
new file mode 100644
index acc261c..ae1ce2e 100644
*** a/doc/src/sgml/catalogs.sgml
--- b/doc/src/sgml/catalogs.sgml
***************
*** 154,159 ****
--- 154,174 ----
+ pg_extension_control
+ Needs documentation
+
+
+
+ pg_extension_template
+ Needs documentation
+
+
+
+ pg_extension_uptmpl
+ Needs documentation
+
+
+ pg_foreign_data_wrapperforeign-data wrapper definitions
***************
*** 3290,3295 ****
--- 3305,3325 ----
+
+ pg_extension_control
+ Needs documentation
+
+
+
+ pg_extension_template
+ Needs documentation
+
+
+
+ pg_extension_uptmpl
+ Needs documentation
+
+
pg_foreign_data_wrapper
diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml
new file mode 100644
index 772310b..b4a589c 100644
*** a/doc/src/sgml/extend.sgml
--- b/doc/src/sgml/extend.sgml
***************
*** 384,398 ****
The command allows a
! superuser to create an Extension's Template>, that users
will then be able to use as the source for their script and control
parameters. Upgrade scripts can be provided with the same command, and
! those upgrade scripts can include parameters update too, as would a
secondary control file.
! Here's a very simple example at using a template for an extension:
create template for extension myextension version '1.0' with (nosuperuser) as
$script$
--- 384,398 ----
The command allows a
! superuser to create an Extension Template>, that users
will then be able to use as the source for their script and control
parameters. Upgrade scripts can be provided with the same command, and
! those upgrade scripts can include parameter updates too, as would a
secondary control file.
! Here's a very simple example of using a template for an extension:
create template for extension myextension version '1.0' with (nosuperuser) as
$script$
*************** create extension myextension;
*** 476,487 ****
This option allows an extension author to avoid shiping all versions
! scripts when shipping an extension. When a version is requested and
! the matching script does not exist on disk,
set default_full_version to the first
script you still ship and PostgreSQL will apply the intermediate
upgrade script as per the ALTER EXTENSION UPDATE
command.
--- 476,488 ----
This option allows an extension author to avoid shiping all versions
! of all scripts when shipping an extension. When a version is requested
! and the matching script does not exist on disk,
set default_full_version to the first
script you still ship and PostgreSQL will apply the intermediate
upgrade script as per the ALTER EXTENSION UPDATE
command.
+ EXAMPLE NEEDED
diff --git a/doc/src/sgml/ref/alter_extension_template.sgml b/doc/src/sgml/ref/alter_extension_template.sgml
new file mode 100644
index 932c73f..527ef8b 100644
*** a/doc/src/sgml/ref/alter_extension_template.sgml
--- b/doc/src/sgml/ref/alter_extension_template.sgml
*************** ALTER TEMPLATE FOR EXTENSION ALTER TEMPLATE FOR EXTENSION changes the definition of
! an extension template.
--- 46,52 ----
ALTER TEMPLATE FOR EXTENSION changes the definition of
! an existing extension template.
*************** ALTER TEMPLATE FOR EXTENSION
The version of the extension we want to install from by default when
using its template. For example, if you have an extension installation
! scipt for version 1.0 and an upgrade script
for 1.0--1.1, you can set the
default full_version to 1.0 so
that PostgreSQL knows to install
--- 79,85 ----
The version of the extension we want to install from by default when
using its template. For example, if you have an extension installation
! script for version 1.0 and an upgrade script
for 1.0--1.1, you can set the
default full_version to 1.0 so
that PostgreSQL knows to install
*************** ALTER TEMPLATE FOR EXTENSION new_name
! The new name of the aggregate function.
--- 113,119 ----
new_name
! The new name of the extension template.
*************** ALTER TEMPLATE FOR EXTENSION new_owner
! The new owner of the aggregate function.
--- 122,128 ----
new_owner
! The new owner of the extension template.
diff --git a/doc/src/sgml/ref/create_extension_template.sgml b/doc/src/sgml/ref/create_extension_template.sgml
new file mode 100644
index 7fc7304..c8563df 100644
*** a/doc/src/sgml/ref/create_extension_template.sgml
--- b/doc/src/sgml/ref/create_extension_template.sgml
*************** PostgreSQL documentation
*** 12,18 ****
CREATE TEMPLATE FOR EXTENSION
! define a new template for extension
--- 12,18 ----
CREATE TEMPLATE FOR EXTENSION
! define a new template for an extension
*************** AS script
*** 57,63 ****
Using the CREATE TEMPLATE FOR EXTENSION command you
! can upload script to be run at CREATE EXTENSION time
and at ALTER EXTENSION ... UPDATE time.
--- 57,63 ----
Using the CREATE TEMPLATE FOR EXTENSION command you
! can upload a script to be run at CREATE EXTENSION time
and at ALTER EXTENSION ... UPDATE time.
*************** AS script
*** 76,95 ****
! COMMENT (string)
! See the comment> control file parameter
in .
! REQUIRES (string)
! See the requires> control file parameter
in .
--- 76,95 ----
! schema (string)
! See the schema> control file parameter
in .
! COMMENT (string)
! See the comment> control file parameter
in .
*************** AS script
*** 140,149 ****
! schema (string)
! See the schema> control file parameter
in .
--- 140,149 ----
! REQUIRES (string)
! See the requires> control file parameter
in .
diff --git a/doc/src/sgml/ref/drop_extension_template.sgml b/doc/src/sgml/ref/drop_extension_template.sgml
new file mode 100644
index 5272014..1f2351c 100644
*** a/doc/src/sgml/ref/drop_extension_template.sgml
--- b/doc/src/sgml/ref/drop_extension_template.sgml
*************** PostgreSQL documentation
*** 31,37 ****
DROP TEMPLATE FOR EXTENSION drops an existing template
! for named extension
--- 31,37 ----
DROP TEMPLATE FOR EXTENSION drops an existing template
! for the named extension
*************** PostgreSQL documentation
*** 43,49 ****
name
! The name of an existing text search template.
--- 43,49 ----
name
! The name of an existing extension template.
*************** PostgreSQL documentation
*** 52,58 ****
CASCADE
! Automatically drop objects that depend on the template.
--- 52,58 ----
CASCADE
! Automatically drop objects that depend on the extension template.
*************** PostgreSQL documentation
*** 61,68 ****
RESTRICT
! Refuse to drop the template if any objects depend on it. This is the
! default.
--- 61,68 ----
RESTRICT
! Refuse to drop the extension template if any objects depend on it.
! This is the default.
diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c
new file mode 100644
index 8320ee6..3f9b042 100644
*** a/src/backend/catalog/objectaddress.c
--- b/src/backend/catalog/objectaddress.c
*************** static ObjectAddress get_object_address_
*** 468,474 ****
List *objname, bool missing_ok);
static ObjectAddress get_object_address_opcf(ObjectType objtype, List *objname,
List *objargs, bool missing_ok);
! static ObjectAddress get_object_address_tmpl(ObjectType objtype,
List *objname, List *objargs, bool missing_ok);
static ObjectPropertyType *get_object_property_data(Oid class_id);
--- 468,474 ----
List *objname, bool missing_ok);
static ObjectAddress get_object_address_opcf(ObjectType objtype, List *objname,
List *objargs, bool missing_ok);
! static ObjectAddress get_object_address_exttmpl(ObjectType objtype,
List *objname, List *objargs, bool missing_ok);
static ObjectPropertyType *get_object_property_data(Oid class_id);
*************** get_object_address(ObjectType objtype, L
*** 562,569 ****
break;
case OBJECT_EXTENSION_TEMPLATE:
case OBJECT_EXTENSION_UPTMPL:
! address = get_object_address_tmpl(objtype,
! objname, objargs, missing_ok);
break;
case OBJECT_TYPE:
case OBJECT_DOMAIN:
--- 562,569 ----
break;
case OBJECT_EXTENSION_TEMPLATE:
case OBJECT_EXTENSION_UPTMPL:
! address = get_object_address_exttmpl(objtype, objname,
! objargs, missing_ok);
break;
case OBJECT_TYPE:
case OBJECT_DOMAIN:
*************** get_object_address_opcf(ObjectType objty
*** 1159,1170 ****
}
/*
! * Find the ObjectAddress for an extension template, control or update
! * template.
*/
static ObjectAddress
! get_object_address_tmpl(ObjectType objtype,
! List *objname, List *objargs, bool missing_ok)
{
const char *name;
ObjectAddress address;
--- 1159,1169 ----
}
/*
! * Find the ObjectAddress for an extension template or update template.
*/
static ObjectAddress
! get_object_address_exttmpl(ObjectType objtype,
! List *objname, List *objargs, bool missing_ok)
{
const char *name;
ObjectAddress address;