From 3f936aacc057e4b391ab953fea2ffb689a12a8bc Mon Sep 17 00:00:00 2001
From: Tom Lane
Date: Sun, 30 Nov 2008 19:01:29 +0000
Subject: Add a "LIKE = typename" clause to CREATE TYPE for base types. This
allows the basic representational details (typlen, typalign, typbyval,
typstorage) to be copied from an existing type rather than listed explicitly
in the CREATE TYPE command. The immediate reason for this is to provide a
simple solution for add-on modules that want to define types represented as
int8, float4, or float8: as of 8.4 the appropriate PASSEDBYVALUE setting is
platform-specific and so it's hard for a SQL script to know what to do.
This patch fixes the contrib/isn breakage reported by Rushabh Lathia.
---
doc/src/sgml/ref/create_type.sgml | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
(limited to 'doc/src')
diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml
index 222d41d28bb..78b11b8a80e 100644
--- a/doc/src/sgml/ref/create_type.sgml
+++ b/doc/src/sgml/ref/create_type.sgml
@@ -1,5 +1,5 @@
@@ -39,6 +39,7 @@ CREATE TYPE name (
[ , PASSEDBYVALUE ]
[ , ALIGNMENT = alignment ]
[ , STORAGE = storage ]
+ [ , LIKE = like_type ]
[ , CATEGORY = category ]
[ , PREFERRED = preferred ]
[ , DEFAULT = default ]
@@ -290,6 +291,21 @@ CREATE TYPE name
external items.)
+
+ The like_type parameter
+ provides an alternative method for specifying the basic representation
+ properties of a data type: copy them from some existing type. The values of
+ internallength,
+ passedbyvalue,
+ alignment, and
+ storage are copied from the
+ named type. (It is possible, though usually undesirable, to override
+ some of these values by specifying them along with the LIKE>
+ clause.) Specifying representation this way is especially useful when
+ the low-level implementation of the new type piggybacks> on an
+ existing type in some fashion.
+
+
The category and
preferred parameters can be
@@ -524,6 +540,22 @@ CREATE TYPE name
+
+ like_type
+
+
+ The name of an existing data type that the new type will have the
+ same representation as. The values of
+ internallength,
+ passedbyvalue,
+ alignment, and
+ storage
+ are copied from that type, unless overridden by explicit
+ specification elsewhere in this CREATE TYPE> command.
+
+
+
+
category
--
cgit v1.2.3