Re: CREATE TYPE with array

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Wolfgang Drotschmann <drotschm(at)fgan(dot)de>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: CREATE TYPE with array
Date: 2003-07-22 13:47:57
Message-ID: 6162.1058881677@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Wolfgang Drotschmann <drotschm(at)fgan(dot)de> writes:
> I tried to create a new type with an array in it. So I took an example
> from (the german translation of) "PostgreSQL: Introduction and Concepts"
> by Bruce Momjian.

> create type int4array (
> input=array_in,output=array_out,
> internallength=variable,element=int4
> );
> ERROR: TypeCreate: function array_out(int4array) does not exist

7.3 is stricter about the declarations of datatype I/O functions than
prior releases were. Since array_out is declared to take anyarray,
not int4array, the above fails.

You could hack your way to a working datatype by creating extra pg_proc
entries for array_in/_out:

regression=# create function int4array_in(cstring) returns int4array
regression-# as 'array_in' language internal strict immutable;
NOTICE: ProcedureCreate: type int4array is not yet defined
CREATE FUNCTION
regression=# create function int4array_out(int4array) returns cstring
regression-# as 'array_out' language internal strict immutable;
NOTICE: Argument type "int4array" is only a shell
CREATE FUNCTION
regression=# create type int4array (
regression(# input=int4array_in, output=int4array_out,
regression(# internallength=variable,element=int4
regression(# );
CREATE TYPE
regression=#

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2003-07-22 14:32:51 Re: Encrypted data.
Previous Message Ben Clewett 2003-07-22 13:00:53 Encrypted data.