Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id eB4HeIG03909 for ; Mon, 4 Dec 2000 12:40:18 -0500 (EST) (envelope-from pgsql-admin-owner@postgresql.org) Received: from snowstorm.mail.pipex.net (snowstorm.mail.pipex.net [158.43.192.97]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id eASGjJt56221 for ; Tue, 28 Nov 2000 11:45:19 -0500 (EST) (envelope-from sraby@computerpark.co.uk) Received: (qmail 10748 invoked from network); 28 Nov 2000 16:45:21 -0000 Received: from userfx50.uk.uudial.com (HELO computerpark.co.uk) (62.188.28.211) by smtp-6.dial.pipex.com with SMTP; 28 Nov 2000 16:45:21 -0000 Received: from Cpark34 (root@[10.0.0.93]) by computerpark.co.uk (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) with SMTP id QAA04983 for ; Tue, 28 Nov 2000 16:40:16 GMT From: Stan Raby Reply-To: sraby@computerpark.co.uk Organization: Computer Park Limited To: pgsql-admin@postgreSQL.org Subject: How do I insert data into a table within a table Date: Tue, 28 Nov 2000 16:19:04 +0000 X-Mailer: KMail [version 1.0.21] Content-Type: text/plain MIME-Version: 1.0 Message-Id: <00112816263400.11277@Cpark34> Content-Transfer-Encoding: 8bit X-Archive-Number: 200012/12 X-Sequence-Number: 203 -- As I understand it when you create a table in postgres that it is automatically a type. Therefore you can then the declare an attribute of this type in another table e.g create table person ( first_name char(20), second_name char(20) ); create table couple ( man person, woman person ); The couple table can be queried without any problems e.g. select * from couple; returns : man|woman ---+----- (0 rows) select couple.man.first_name, couple.man.second_name from couple; returns : first_name|second_name ----------+----------- (0 rows) But how do you put data into the couple table ? I have tried a number of methods but without any success. e.g. insert into couple(couple.man.first_name,couple.man.second_name,couple.woman.first_name,couple.woman.second_name) values('Fred','Smith','Jane','White'); insert into couple(man(first_name,second_name),woman(first_name,second_name)) values('Fred','Smith','Jane','White'); insert into couple.man.first_name,couple.man.second_name,couple.woman.first_name,couple.woman.second_name values('Fred','Smith','Jane','White'); insert into couple(man.first_name,man.second_name,woman.first_name,woman.second_name) values('Fred','Smith','Jane','White'); All of these (plus others) all produce parser errors. e.g. ERROR : parser: parse error at or near "." Thankyou in advance for any help. ------------------------------------ Stan Raby Computer Park Limited Tel: +44 1536 417155 Fax: +44 1536 417566 email: sraby@computerpark.co.uk