From: Andrew Chernow on
Peter Eisentraut wrote:
> On tor, 2009-11-05 at 19:24 +0200, Peter Eisentraut wrote:
>> I'm planning to work on typed tables support. The idea is that you
>> create a table out of a composite type (as opposed to the other way
>> around, which is currently done automatically).
>>
>> CREATE TYPE persons_type AS (name text, bdate date);
>>
>> CREATE TABLE persons OF persons_type;
>>
>> Or the fancy version:
>>
>> CREATE TABLE persons OF persons_type ( PRIMARY KEY (name) );
>
> And here is the first patch for that. The feature is complete as far as
> I had wanted it. I would like to add ALTER TYPE support, but that can
> come as a separate patch.

+1

ISTM that the ultimate would be a 'create table (...._) without storage'
(or some'm) and make 'create type' an alternate syntax for SQL
conformance. For various reasons, we've internally adopted using create
table for all composites and use a c-like naming convenstion of
appending _t to such beasts.

I'll just throw a little meat into the pack wolves....constraints....?

--
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
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.

> For various reasons, we've internally adopted using create
> table for all composites and use a c-like naming convenstion of
> appending _t to such beasts.

Yes, I have a similar convention.


--
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
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?

--
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
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.


--
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: Pavel Stehule on
2010/1/12 Peter Eisentraut <peter_e(a)gmx.net>:
> 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.

it should help only for "small" tables. It's looks well, but it can be
very slow and very memory expensive for bigger tables. I thing, we
need some QUERY->cursor translation mechanism. Memory based solution
(with arrays) is better than nothing, but it cannot be for all.

Pavel

>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers