Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id 15BB89FA217 for ; Mon, 13 Nov 2006 15:04:18 -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 54291-01 for ; Mon, 13 Nov 2006 15:04:15 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187]) by postgresql.org (Postfix) with ESMTP id C4FF29FA12B for ; Mon, 13 Nov 2006 15:04:14 -0400 (AST) Received: by nf-out-0910.google.com with SMTP id x4so2212645nfb for ; Mon, 13 Nov 2006 11:04:13 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=XL/0rCOzaElB7BWaNEpMmzFvi0553qSsy4oP0wLW1bZ1KBeX0yT13l/Q+AwlyNWXnbbIWa0JeCjsWP97x6U9od0mX2cJQUF8iOaIn91t/IHGuKJb0faB9VGOuqah36dF41hCvnJoAyzwbOBWRlch4y6rsVmSQPYsV7oYaoqUtaQ= Received: by 10.82.107.15 with SMTP id f15mr218785buc.1163444652841; Mon, 13 Nov 2006 11:04:12 -0800 (PST) Received: by 10.82.161.3 with HTTP; Mon, 13 Nov 2006 11:04:12 -0800 (PST) Message-ID: <1f30b80c0611131104y3e257fddg6286dd548507b279@mail.gmail.com> Date: Tue, 14 Nov 2006 00:04:12 +0500 From: imad To: rodrigo.sakai@zanthus.com.br Subject: Re: Another question about composite types Cc: "Richard Broersma Jr" , pgsql-sql@postgresql.org In-Reply-To: <000c01c70757$dbe70c90$4700a8c0@TREEZANTHUS> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <277719.72609.qm@web31811.mail.mud.yahoo.com> <000c01c70757$dbe70c90$4700a8c0@TREEZANTHUS> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/145 X-Sequence-Number: 26797 There is always an _typname created for arrays like we have _int4 for _int4, _varchar for varchar and _timestamp for timestamp etc. May be you have to write some _typname for your type to use it in arrays. We always use array_in and array_out for _typenames BTW. This may be helpful to you. --Imad www.EnterpriseDB.com On 11/14/06, Rodrigo Sakai wrote: > 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. > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend >