Re: Composite Types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mjp(at)ornl(dot)gov
Cc: pgsql-general(at)postgresql(dot)org, parangm(at)ornl(dot)gov
Subject: Re: Composite Types
Date: 2000-06-07 04:09:45
Message-ID: 1948.960350985@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

mjp(at)ornl(dot)gov writes:
> I appreciate any help I can get on this...Recently, I've been experimenting
> with the user defined base-types (using CREATE TYPE) with successful results.
> But, when it comes to handling classes as composite types, things are not
> as straight forward.

The function-returning-composite-type feature is something we inherited
from Berkeley Postgres ---- it doesn't fit into SQL92 at all, and I
don't think any of the current crop of developers even understand it
very well. It's certainly suffering from bit-rot. The "hobbies"
examples in the regression tests seem to be meant to illustrate how
it was supposed to work, but I don't find them either intelligible or
persuasive.

> If I type:
> select content from stuff;
> I get:

> content
> -----------
> 136585664
> (1 row)

I believe you are looking at a numeric equivalent of a pointer-to-
TupleTableSlot there. Somewhere in the mists of Berkelian prehistory,
there must have been some code that did something useful with that kind
of function result, but I sure as heck can't find much trace of it now.

I have been thinking lately that functions returning tuples might
fit into SQL92 better as table sources. That is, instead of
select foo(bar).whatdoyouwritehere ...
we could write something like
select elementa,elementc+1 from foo(bar)

That doesn't work at the moment, of course, but it's something we
could think about causing to work as part of the querytree redesign
planned for 7.2.

Thoughts anyone?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-06-07 04:20:23 Re: getting inet out of char?
Previous Message Kyle 2000-06-07 02:42:20 basic DB design question / joins