pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rodrigo Sakai <rodrigo.sakai@zanthus.com.br>
To: 'Richard Broersma Jr' <rabroersma@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: RES: Another question about composite types
Date: Mon, 13 Nov 2006 16:13:48 -0300
Message-ID: <000c01c70757$dbe70c90$4700a8c0@TREEZANTHUS> (raw)
In-Reply-To: <277719.72609.qm@web31811.mail.mud.yahoo.com>

  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.




Message-ID: <000c01c70757$dbe70c90$4700a8c0@TREEZANTHUS>
Permalink:  ../000c01c70757$dbe70c90$4700a8c0@TREEZANTHUS/
Also on:    postgresql.org/message-id/000c01c70757$dbe70c90$4700a8c0@TREEZANTHUS

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rodrigo.sakai@zanthus.com.br, rabroersma@yahoo.com
  Subject: Re: RES: Another question about composite types
  In-Reply-To: <000c01c70757$dbe70c90$4700a8c0@TREEZANTHUS>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox