Peter Eisentraut wrote:
> On tis, 2010-01-12 at 08:05 -0500, Andrew Chernow wrote:
>> In practice, tables can be used for passing data around or storing it on disk.
>> So, I guess my question remains unanswered as to what the composite type offers
>> that a table doesn't; other than a name that better suits the task.
> The arguments of functions are types, not tables. So you need types if
> you want to use functions.
create table mytype_t (a int, b int);
create function mytype_func(t mytype_t) returns int as
select ($1).a + ($1).b;
$$ language sql;
select mytype_func((10, 10)::mytype_t);
A table is a record type (backend/util/adt/rowtypes.c) as is a
composite. One difference is pg_class.relkind is 'r' for relation vs.
'c' for composite.
every bit counts
In response to
pgsql-hackers by date
|Next:||From: Tom Lane||Date: 2010-01-12 14:39:50|
|Subject: Re: Streaming replication status |
|Previous:||From: Peter Eisentraut||Date: 2010-01-12 14:35:29|
|Subject: Re: pg_dump sort order for functions|