From: Andrew Chernow on 12 Jan 2010 08:05 Peter Eisentraut wrote: > On mån, 2010-01-11 at 19:27 -0500, Andrew Chernow wrote: >> Peter Eisentraut wrote: >>> On mån, 2010-01-11 at 15:02 -0500, Andrew Chernow wrote: >>>> ISTM that the ultimate would be a 'create table (...._) without storage' >>>> (or some'm) and make 'create type' an alternate syntax for SQL >>>> conformance. >>> I don't really understand the purpose of that. >>> >> What is the point of CREATE TYPE name AS () syntax? Why would one use create >> type when there is create table? Does it provide additional functionality I am >> unaware of or does it exist for comformance reasons? > > Well, that is a very deep question. ;-) I suppose a concise answer > would be that types are for passing data around between functions, and > tables are for storing data on disk. > > 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. -- Andrew Chernow eSilo, LLC every bit counts http://www.esilo.com/ -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: Peter Eisentraut on 12 Jan 2010 08:53 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. -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: Andrew Dunstan on 12 Jan 2010 09:00 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. > > > What is the point of this discussion? We're not going to remove the facility for composite types, regardless of whether or not some people regard them as unnecessary. And "a name that better suits the task" is not to be sneered at anyway. cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: Andrew Chernow on 12 Jan 2010 09:36 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. really.... 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); mytype_func ------------- 20 (1 row) 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. -- Andrew Chernow eSilo, LLC every bit counts http://www.esilo.com/ -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: Andrew Chernow on 12 Jan 2010 09:43 > > What is the point of this discussion? We're not going to remove the > facility for composite types, regardless of whether or not some people > regard them as unnecessary. And "a name that better suits the task" is > not to be sneered at anyway. > I never asked for anything to be removed nor do I sneer :) Honestly, I was only trying to understand why it existed. -- Andrew Chernow eSilo, LLC every bit counts http://www.esilo.com/ -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: [HACKERS] RADIUS authentication Next: Red-black tree for GIN |