Array of created types

Started by Kelly Burkhartover 20 years ago2 messagesgeneral
Jump to latest
#1Kelly Burkhart
kelly@tradebotsystems.com

Should something similar to the following be possible in PG 8.0.3?

create type foo_t as ( c1 int, c2 int );
create table tab (
name varchar not null,
foos foo_t[]
);

The response I get is:

ERROR: type "foo_t[]" does not exist

The create type documentation says that postgres silently creates an
array type for each base type with an underscore prepended to the base
name. That makes it sound like the following should work:

create table tab (
name varchar not null,
foos _foo_t
);
ERROR: type "_foo_t" does not exist

How can I create a table containing an array of items of a created type?

-K

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Kelly Burkhart (#1)
Re: Array of created types

Kelly Burkhart <kelly@tradebotsystems.com> writes:

The create type documentation says that postgres silently creates an
array type for each base type with an underscore prepended to the base
name.

"Base type" in this context specifically means "not composite type".
We may support that someday, but it doesn't work now.

regards, tom lane