Dear group,
when I try to insert a statement :
INSERT INTO
processed_data(exp_id,seq_anno_id,cel_id,proc_symbol,proc_exprs,proc_pval)VALUES((currval('experiment_exp_id_seq')),(SELECT
platform_id from platform where platform_filename =
'RGeo-ESHSC-H1ES1-1a-U133A'),(SELECT seq_anno_id FROM
sequence_annotation, genechip WHERE
sequence_annotation.seq_probeset_id =
'AFFX-r2-Ec-bioB-M_at'AND
sequence_annotation.genechip_id = genechip.genechip_id
AND genechip.genechip_array =
'U133A'),'AFFX-r2-Ec-bioB-M_at',6.419,0.1671675);
I get a weird error:
Now I took the :
bob=> (SELECT seq_anno_id FROM sequence_annotation,
genechip WHERE sequence_annotation.seq_probeset_id =
'AFFX-r2-Ec-bioB-M_at'AND
sequence_annotation.genechip_id = genechip.genechip_id
AND genechip.genechip_array = 'U133A');
seq_anno_id
-------------
45881
(1 row)
Why is it so?
When I give the select statement seperate I get the
answer and when I embed the same in INSERT statement I
get the following error:
ERROR: insert or update on table "processed_data"
violates foreign key constraint "$3"
DETAIL: Key (seq_anno_id)=(6) is not present in table
"sequence_annotation".
My sequence_annotation table:
seq_anno_id | integer |
not null default
nextval('public.sequence_annotation_seq_anno_id_
seq'::text)
seq_probeset_id | character varying(15000) |
seq_source | character varying(15000) |
.......................|.........................
Indexes:
"sequence_annotation_pkey" primary key, btree
(seq_anno_id)
Foreign-key constraints:
"$1" FOREIGN KEY (genechip_id) REFERENCES
genechip(genechip_id)
My Processed data table:
proc_id | integer | not null
default
nextval('public.processed_data_proc_id_seq'::text)
exp_id | integer |
seq_anno_id | integer |
cel_id | integer |
proc_symbol | character varying(100) |
proc_exprs | real |
proc_pval | real |
Indexes:
"processed_data_pkey" primary key, btree (proc_id)
Foreign-key constraints:
"$2" FOREIGN KEY (exp_id) REFERENCES
experiment(exp_id)
"$3" FOREIGN KEY (seq_anno_id) REFERENCES
sequence_annotation(seq_anno_id)
"$4" FOREIGN KEY (cel_id) REFERENCES cel(cel_id)
Sorry if the wrapping of text makes it uncomfortable
for you to read.
__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/