when I create a table, postgresql creates a new type

Started by Julio Misael Gutierrezover 22 years ago3 messagesgeneral
Jump to latest
#1Julio Misael Gutierrez
jmisaelg@amnetsal.com

Good day,
I�m testing PostGresql,
I would like to Know why when I create a new table,
postgresql create a new type with the same name of the table.
Where I can find more information about this?.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Julio Misael Gutierrez (#1)
Re: when I create a table, postgresql creates a new type

"Julio Misael Gutierrez" <jmisaelg@amnetsal.com> writes:

I would like to Know why when I create a new table,
postgresql create a new type with the same name of the table.

Because there is a row type (composite type) associated with every
table.

regards, tom lane

#3scott.marlowe
scott.marlowe@ihs.com
In reply to: Julio Misael Gutierrez (#1)
Re: when I create a table, postgresql creates a new type

On Thu, 15 Jan 2004, Julio Misael Gutierrez wrote:

Good day,
I�m testing PostGresql,
I would like to Know why when I create a new table,
postgresql create a new type with the same name of the table.
Where I can find more information about this?.

To add to what Tom said, this allows you to create functions that return a
set of 'newtable_type' where newtable_type is the newtable you've
created. I.e. you can have a function return rows just like the table you
created. nifty, huh?