Re: Arrays of Complex Types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: David Fetter <david(at)fetter(dot)org>, andrew(at)supernews(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Arrays of Complex Types
Date: 2007-03-28 17:35:54
Message-ID: 4594.1175103354@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Hmm, I question the usefulness of automatically creating array types for
> all relation types that are created -- the catalog bloat seems a bit too
> much. An array of pg_autovacuum for example, does that make sense?

Not only that, it won't even work for pg_statistic, which has got a
special kluge to allow anyarray in a place where it usually mustn't go.

> I'm not sure what was the reaction to having an "CREATE TYPE foo ARRAY
> OF bar" command of some kind? I think this was discussed but not
> explicitely rejected, or was it?

I think this is a much better idea than automatically creating a pile of
usually-useless types. In the long run maybe we should even migrate to
the assumption that array types aren't automatically created?

If we think this way, it changes the ground rules for Andrew's question
about whether an array type ought to be affected by ALTER TYPE SET
SCHEMA on its base type --- it starts to look more like an independent
entity than an auxiliary component. I'm not really sure which answer
I like better.

One point here is that currently the system depends on the naming
convention "foo[] is named _foo" to be able to find the array type
from the base type. The syntax you suggest would break that. We
could fix it by adding More Stuff to pg_type, but I wonder whether
it's worth it, compared to say
CREATE ARRAY TYPE FOR foo
Also, at the moment ALTER TYPE SET SCHEMA is certainly broken because
it destroys this naming convention ... we either abandon the convention
or fix SET SCHEMA.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2007-03-28 17:38:49 Re: Modifying TOAST thresholds
Previous Message Andrew Dunstan 2007-03-28 17:33:56 Re: Arrays of Complex Types

Browse pgsql-patches by date

  From Date Subject
Next Message David Fetter 2007-03-28 18:48:57 Re: Arrays of Complex Types
Previous Message Andrew Dunstan 2007-03-28 17:33:56 Re: Arrays of Complex Types