Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id D889B9FBB5F for ; Mon, 13 Nov 2006 14:33:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 38601-02-4 for ; Mon, 13 Nov 2006 14:33:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.zanthus.com.br (mail.zanthus.com.br [200.212.65.85]) by postgresql.org (Postfix) with ESMTP id 2CCE59FBD0B for ; Mon, 13 Nov 2006 14:14:24 -0400 (AST) Received: from cprsakai (unknown [192.168.0.71]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mail.zanthus.com.br (Postfix) with ESMTP id ECAB623FCB; Mon, 13 Nov 2006 16:19:42 -0200 (BRST) Reply-To: From: "Rodrigo Sakai" To: "'Richard Broersma Jr'" , Subject: RES: Another question about composite types Date: Mon, 13 Nov 2006 16:13:48 -0300 Organization: Zanthus Message-ID: <000c01c70757$dbe70c90$4700a8c0@TREEZANTHUS> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: AccHTIQwusKf3giNTaW58Vn2DKFtLAACuW6g In-Reply-To: <277719.72609.qm@web31811.mail.mud.yahoo.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 X-Zanthus-MailScanner: Found to be clean X-Zanthus-MailScanner-From: rodrigo.sakai@zanthus.com.br X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/139 X-Sequence-Number: 26791 I know that if I create a table salary that references my employee table works! But I'm trying to work with the composite type concept! Thinking in Object-Oriented Programming (OOP) I have a class employee that is composed by the class salary among other things! Like: Class salary { private float value; private date validity; } Class employee { private int ID; private String name; private salary[] sal; } So I'd like to map these classes to PostgreSQL. I think nested tables are one of the advantages of object-relational databases. And it works if I think in just one salary for each employee. But I want to keep all salary history for each employee. Is there any way? -----Mensagem original----- De: Richard Broersma Jr [mailto:rabroersma@yahoo.com] Enviada em: segunda-feira, 13 de novembro de 2006 14:46 Para: rodrigo.sakai@zanthus.com.br; pgsql-sql@postgresql.org Assunto: Re: [SQL] Another question about composite types > CREATE TYPE t_salary AS (Value numeric(10,2), Validity date); > CREATE TABLE employee (id int, name varchar(30), salary t_salary[]); > > That is, I need an array of composite type and searching on google I found > that is impossible to do it! Is it really impossible? Anyone have do it ? Why not use a conventional table to hold this information that references your employee table? Regards, Richard Broersma Jr.