Structured Types, Oids and Reference Types - Mailing list pgsql-general

From Craig Anslow
Subject Structured Types, Oids and Reference Types
Date
Msg-id 200210042015.14049.craig@mcs.vuw.ac.nz
Whole thread Raw
Responses Re: Structured Types, Oids and Reference Types  (Richard Huxton <dev@archonet.com>)
List 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 by date:

Previous
From: "Shridhar Daithankar"
Date:
Subject: Re: [HACKERS] Large databases, performance
Next
From: Siva Kumar
Date:
Subject: Query optimization