1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

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.
This commit is contained in:
Tom Lane
2008-11-30 19:01:29 +00:00
parent 0ddede58e6
commit 3f936aacc0
3 changed files with 208 additions and 111 deletions

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/contrib/isn/isn.sql.in,v 1.8 2007/11/13 04:24:28 momjian Exp $ */
/* $PostgreSQL: pgsql/contrib/isn/isn.sql.in,v 1.9 2008/11/30 19:01:29 tgl Exp $ */
-- Adjust this setting to control where the objects get created.
SET search_path = public;
@ -28,9 +28,7 @@ CREATE OR REPLACE FUNCTION ean13_out(ean13)
CREATE TYPE ean13 (
INPUT = ean13_in,
OUTPUT = ean13_out,
INTERNALLENGTH = 8,
ALIGNMENT = double,
STORAGE = PLAIN
LIKE = pg_catalog.int8
);
COMMENT ON TYPE ean13
IS 'International European Article Number (EAN13)';
@ -48,9 +46,7 @@ CREATE OR REPLACE FUNCTION ean13_out(isbn13)
CREATE TYPE isbn13 (
INPUT = isbn13_in,
OUTPUT = ean13_out,
INTERNALLENGTH = 8,
ALIGNMENT = double,
STORAGE = PLAIN
LIKE = pg_catalog.int8
);
COMMENT ON TYPE isbn13
IS 'International Standard Book Number 13 (ISBN13)';
@ -68,9 +64,7 @@ CREATE OR REPLACE FUNCTION ean13_out(ismn13)
CREATE TYPE ismn13 (
INPUT = ismn13_in,
OUTPUT = ean13_out,
INTERNALLENGTH = 8,
ALIGNMENT = double,
STORAGE = PLAIN
LIKE = pg_catalog.int8
);
COMMENT ON TYPE ismn13
IS 'International Standard Music Number 13 (ISMN13)';
@ -88,9 +82,7 @@ CREATE OR REPLACE FUNCTION ean13_out(issn13)
CREATE TYPE issn13 (
INPUT = issn13_in,
OUTPUT = ean13_out,
INTERNALLENGTH = 8,
ALIGNMENT = double,
STORAGE = PLAIN
LIKE = pg_catalog.int8
);
COMMENT ON TYPE issn13
IS 'International Standard Serial Number 13 (ISSN13)';
@ -110,9 +102,7 @@ CREATE OR REPLACE FUNCTION isn_out(isbn)
CREATE TYPE isbn (
INPUT = isbn_in,
OUTPUT = isn_out,
INTERNALLENGTH = 8,
ALIGNMENT = double,
STORAGE = PLAIN
LIKE = pg_catalog.int8
);
COMMENT ON TYPE isbn
IS 'International Standard Book Number (ISBN)';
@ -130,9 +120,7 @@ CREATE OR REPLACE FUNCTION isn_out(ismn)
CREATE TYPE ismn (
INPUT = ismn_in,
OUTPUT = isn_out,
INTERNALLENGTH = 8,
ALIGNMENT = double,
STORAGE = PLAIN
LIKE = pg_catalog.int8
);
COMMENT ON TYPE ismn
IS 'International Standard Music Number (ISMN)';
@ -150,9 +138,7 @@ CREATE OR REPLACE FUNCTION isn_out(issn)
CREATE TYPE issn (
INPUT = issn_in,
OUTPUT = isn_out,
INTERNALLENGTH = 8,
ALIGNMENT = double,
STORAGE = PLAIN
LIKE = pg_catalog.int8
);
COMMENT ON TYPE issn
IS 'International Standard Serial Number (ISSN)';
@ -170,9 +156,7 @@ CREATE OR REPLACE FUNCTION isn_out(upc)
CREATE TYPE upc (
INPUT = upc_in,
OUTPUT = isn_out,
INTERNALLENGTH = 8,
ALIGNMENT = double,
STORAGE = PLAIN
LIKE = pg_catalog.int8
);
COMMENT ON TYPE upc
IS 'Universal Product Code (UPC)';