Structured Types, Oids and Reference Types
От | Craig Anslow |
---|---|
Тема | Structured Types, Oids and Reference Types |
Дата | |
Msg-id | 200210042015.14049.craig@mcs.vuw.ac.nz обсуждение исходный текст |
Ответы |
Re: Structured Types, Oids and Reference Types
|
Список | pgsql-general |
Hi I would like to know if anyone could answer my questions: ------------------------------------------------------------------------------------- Structured Types ------------------------------------------------------------------------------------- 1) What collection types does PostgreSQL support, i.e. lists, arrays, setof and bagof? As far as I can see it supports arrays and multidimensional arrays. It also supports setof(type) as a return type in a function. e.g. CREATE TABLE Class (CourseId char(7), Year char(2), Students text[]); However below does not work with setof(text): CREATE TABLE Class_Nest(CourseID char(7), Year char(2), Students setof(text)); 2) How to iterate through the collection type? Which is I presume is just arrays. I can currently only access one element at a time in the array but would like to know how to iterate through an array? 3) What set oriented operations ( i.e. IN, SUBSET, UNION, INTERSECT, EXCEPT...) are allowed on the collection types (i.e. lists, arrays, setof and bagof)? I can't get anyone them to work on a collection type of an array. ------------------------------------------------------------------------------------- Oids and Reference Types ------------------------------------------------------------------------------------- 1) Does PostgreSQL support tuple AND table oids? I believe tuple oids are like unique ids for each row in a table/relation. However I am confused over what a table oid is. Is a table oid an identifier for a complete table/relation? e.g. if there were three tables A,B, and C then we could assign 3 different oids to them say 1,2, and 3 respectively. 2) Can you dereference tuples or columns in a query by using a "deref" function (DEREF is a keyword) for '.' or C type syntax '->'. i.e select e.Job->jobid from Employee e; or select e.deref(Job).jobid from Employee e; I can't seem to get either option to work. Cheers Craig Email: craig@mcs.vuw.ac.nz
В списке pgsql-general по дате отправления: