diff options
author | Bruce Momjian <bruce@momjian.us> | 2002-08-15 16:36:08 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2002-08-15 16:36:08 +0000 |
commit | b1a5f8720987fbfda23c6bfb4a0dd683b9bdae70 (patch) | |
tree | 9212ba16b7941ad741708dd0999beaf3e6948232 /doc/src | |
parent | 38294db64bce9e78e6a1fc55fb6746074de59d2b (diff) | |
download | postgresql-b1a5f8720987fbfda23c6bfb4a0dd683b9bdae70.tar.gz postgresql-b1a5f8720987fbfda23c6bfb4a0dd683b9bdae70.zip |
Tom Lane wrote:
> There's no longer a separate call to heap_storage_create in that routine
> --- the right place to make the test is now in the storage_create
> boolean parameter being passed to heap_create. A simple change, but
> it passeth patch's understanding ...
Thanks.
Attached is a patch against cvs tip as of 8:30 PM PST or so. Turned out
that even after fixing the failed hunks, there was a new spot in
bufmgr.c which needed to be fixed (related to temp relations;
RelationUpdateNumberOfBlocks). But thankfully the regression test code
caught it :-)
Joe Conway
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/create_type.sgml | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml index d4860cff80d..9da93a42d28 100644 --- a/doc/src/sgml/ref/create_type.sgml +++ b/doc/src/sgml/ref/create_type.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_type.sgml,v 1.30 2002/07/24 19:11:07 petere Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_type.sgml,v 1.31 2002/08/15 16:36:00 momjian Exp $ PostgreSQL documentation --> @@ -30,6 +30,13 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> ( INPUT = <rep [ , ALIGNMENT = <replaceable class="parameter">alignment</replaceable> ] [ , STORAGE = <replaceable class="parameter">storage</replaceable> ] ) + +CREATE TYPE <replaceable class="parameter">typename</replaceable> AS + ( <replaceable class="PARAMETER">column_definition_list</replaceable> ) + +where <replaceable class="PARAMETER">column_definition_list</replaceable> can be: + +( <replaceable class="PARAMETER">column_name</replaceable> <replaceable class="PARAMETER">data_type</replaceable> [, ... ] ) </synopsis> <refsect2 id="R2-SQL-CREATETYPE-1"> @@ -138,6 +145,25 @@ CREATE TYPE <replaceable class="parameter">typename</replaceable> ( INPUT = <rep </para> </listitem> </varlistentry> + + <varlistentry> + <term><replaceable class="PARAMETER">column_name</replaceable></term> + <listitem> + <para> + The name of a column of the composite type. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><replaceable class="PARAMETER">data_type</replaceable></term> + <listitem> + <para> + The name of an existing data type. + </para> + </listitem> + </varlistentry> + </variablelist> </para> </refsect2> @@ -191,9 +217,9 @@ CREATE TYPE </para> <para> - <command>CREATE TYPE</command> requires the registration of two functions - (using CREATE FUNCTION) before defining the type. The - representation of a new base type is determined by + The first form of <command>CREATE TYPE</command> requires the + registration of two functions (using CREATE FUNCTION) before defining the + type. The representation of a new base type is determined by <replaceable class="parameter">input_function</replaceable>, which converts the type's external representation to an internal representation usable by the @@ -288,6 +314,14 @@ CREATE TYPE <literal>extended</literal> and <literal>external</literal> items.) </para> + <para> + The second form of <command>CREATE TYPE</command> requires a column + definition list in the form ( <replaceable class="PARAMETER">column_name</replaceable> + <replaceable class="PARAMETER">data_type</replaceable> [, ... ] ). This + creates a composite type, similar to that of a TABLE or VIEW relation. + A stand-alone composite type is useful as the return type of FUNCTION. + </para> + <refsect2> <title>Array Types</title> @@ -372,6 +406,15 @@ CREATE TYPE bigobj (INPUT = lo_filein, OUTPUT = lo_fileout, CREATE TABLE big_objs (id int4, obj bigobj); </programlisting> </para> + + <para> + This example creates a composite type and uses it in + a table function definition: +<programlisting> +CREATE TYPE compfoo AS (f1 int, f2 int); +CREATE FUNCTION getfoo() RETURNS SETOF compfoo AS 'SELECT fooid, foorefid FROM foo' LANGUAGE SQL; +</programlisting> + </para> </refsect1> <refsect1 id="SQL-CREATETYPE-compatibility"> |