Re: Foreign key error, please help.

Поиск
Список
Период
Сортировка
От Kumar S
Тема Re: Foreign key error, please help.
Дата
Msg-id 20050309144645.59114.qmail@web51406.mail.yahoo.com
обсуждение исходный текст
Ответ на Foreign key error, please help.  (Kumar S <ps_postgres@yahoo.com>)
Ответы Re: Foreign key error, please help.  (Bruno Wolff III <bruno@wolff.to>)
Re: Foreign key error, please help.  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-novice
Hi Stephan,
Thank you very much, it was my stupid mistake.

One more question. aplogies if this is also not so
worthy question.
In a transaction does currval work only if a previous
statement defines it.  In my case I wanted to get FK
from existing currval in sample table (sample_id).
when I execute my statements in a transasction, I get
the following error. Do I have to just use a SELECT
statement here, because currval is not working? Or did
i made a mistake instead?

Thank you.



My statement:
BEGIN TRANSACTION;
INSERT INTO

HYBRID_LABEL(sample_id,hyb_extraction_method,hyb_rna_mrna_genomicdna_extracted,hyb_amplification_pcr_rnapol,hyb_amount_nacid_labeled,hyb_label_used,hyb_label_incorporation_method,hyb_solution,hyb_blocking_agent,hyb_wash_procedure,hyb_quantity_labeled_target,hyb_time,hyb_concentration,hyb_volume,hyb_temp,hyb_instrument_desc)VALUES(currval('sample_sample_id_seq'),'NA','NA','NA','NA','NA','NA','NA','NA','NA','NA','NA','NA','NA','NA','NA');



bob=> \i /home/torun/ESHSC-H1ES/test.sql
BEGIN
psql:/home//torun/ESHSC-H1ES/test.sql:2: ERROR:
currval of sequence "sample_sample_id_seq" is not yet
defined in this session
bob=> rollback


--- Stephan Szabo <sszabo@megazone.bigpanda.com>
wrote:
> On Tue, 8 Mar 2005, Kumar S wrote:
>
> > 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);
>
> It looks to me like the select platform_id subselect
> is in the column
> position for seq_anno_id not the select seq_anno_id
> subselect which
> doesn't seem to be what's intended.
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

В списке pgsql-novice по дате отправления:

Предыдущее
От: John DeSoi
Дата:
Сообщение: Re: QT3 Designer Pgadmin III and PgAccess Cannot connect to PostgreSQL 7.4 database
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Foreign key error, please help.