Re: Duplication error . please help.

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Kumar S <ps_postgres(at)yahoo(dot)com>
Cc: pgsqlnovice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Duplication error . please help.
Date: 2005-03-09 21:35:52
Message-ID: fd9335d7a58dd33667af4c2ff911555e@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Mar 9, 2005, at 4:02 PM, Kumar S wrote:

> Dear group,
>
> Looking forward to get some help form experiences
> members.
>
> BEGIN TRANSACTION;
> INSERT INTO
> EXPERIMENT(study_id,genechip_id,sample_id,mat_id,hyb_id,exp_aim)VALUES(
> (SELECT
> study_id from study where study_author = 'Georgantas
> RW 3rd and Civin CI'),(SELECT genechip_id from
> genechip where genechip_array = 'U133B'),(SELECT
> sample_id FROM sample WHERE sample_name ='Human stem
> cells'),(SELECT mat_id FROM material_manip where
> mat_treatment_type = 'ES H1-1a'),(select hyb_id from
> experiment where exp_id =
> (currval('experiment_exp_id_seq'))),'In this
> experiment ES H1-1a sample was used test on U133B chip
> ');
> INSERT INTO
> PLATFORM(platform_filename,platform_file_loc,exp_id)VALUES('RGeo-
> ESHSC-H1ES-1a-U133B','\/home\/database\/bob\/data\/es\/RGeo-ESHSC-
> H1ES-1a-U133\/RGeo-ESHSC-H1ES-1a-
> U133B',(currval('experiment_exp_id_seq')));
>

Looks like RGeo-EHHSC.... might already be in PLATFORM? Do you have a
unique or primary key on platform_filename to make sure that you never
have more than 1, if you are expecting them to be unique?
> I get the following error, when I execute.
> BEGIN
> INSERT 132600251 1
> INSERT 132600252 1
> psql:/home/database/bob/dbsqls/torun/ESHSC-H1ES/test.sql:6:
> ERROR: more than one row returned by a subquery used
> as an expression

Looks like RGeo-EHHSC... might already be in PLATFORM as a
platform_filename, causing 2 records to be returned by the above
subquery? Do you have a unique or primary key on platform_filename to
make sure that you never have more than 1, if you are expecting them to
be unique?

> psql:/home/database/bob/dbsqls/torun/ESHSC-H1ES/test.sql:8:
> ERROR: current transaction is aborted, commands
> ignored until end of transaction block
> psql:/home/database/bob/dbsqls/torun/ESHSC-H1ES/test.sql:10:
> ERROR: current transaction is aborted, commands
> ignored until end of transaction block
> psql:/home/database/bob/dbsqls/torun/ESHSC-H1ES/test.sql:12:
> ERROR: current transaction is aborted, commands
> ignored until end of transaction block

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message operationsengineer1 2005-03-09 22:48:20 Re: Getting started - Interfacing questions
Previous Message Kumar S 2005-03-09 21:02:06 Duplication error . please help.