Re: Inserting data in composite types

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: rodrigo(dot)sakai(at)zanthus(dot)com(dot)br
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Inserting data in composite types
Date: 2006-11-13 17:49:36
Message-ID: 1163440176.12372.44.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2006-11-13 at 09:37 -0300, Rodrigo Sakai wrote:
> Hi, I have a question about how to insert data in composite types!
>
>
>
> Imagine the exemple:
>
>
>
> CREATE TYPE t_time AS (
>
> a date,
>
> b date
>
> );
>
>
>
> CREATE TABLE salary (
>
> salary numeric(10,2),
>
> t_date t_time
>
> );
>
>
>
> I know that if I want to insert data in the table SALARY I just have
> to do like:
>
>
>
> INSERT INTO salary VALUES (1000.00, ‘(2006/10/10, 2006/12/10)’);
>
>
>
> But if I have another table:
>
>
>
> CREATE TABLE employee (
>
> employee_id int,
>
> name varchar(30),
>
> emp_salary salary
>
> )
>
>
>
> How can I insert a single row in this table???
>
>

insert into employee values(1,'name',(1000,
('2006/10/10','2006/10/10')));

Regards,
Jeff Davis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message koppelp 2006-11-13 17:51:06 kerberos authentication error with Windows 2003 SP1 AD
Previous Message Matthew T. O'Connor 2006-11-13 17:43:29 Re: AutoVacuum on demand?