Re: Table Merge Successful, Primary Keys Missing

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: operationsengineer1(at)yahoo(dot)com, pgsql-novice(at)postgresql(dot)org
Subject: Re: Table Merge Successful, Primary Keys Missing
Date: 2006-06-27 00:58:24
Message-ID: 20060627005824.10362.qmail@web31806.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> > > > select *
> > > > into t_temp_final
> > > > from t_temp_output
> > > > union
> > > > SELECT * FROM t_product
> > > > ;
> > select nextval(what_ever_your_sequence_name_is),
> > colA, colB, colC, ...
> > into t_temp_final
> > from t_temp_output
> > union
> > SELECT * FROM t_product
> > ;
> select nextval(product_id), *
> from t_temp_output
> the column for nextval has no values. if i try...
> select nextval(t_temp_output_product_id_seq), *
> from t_temp_output
> ;
> i get the following error:
> ERROR: column "t_product_product_id_seq" does not exist

I believe that the sequence name must be in quotes nextval('t_temp_output_product_id_seq').

Just to test that the syntax works you should be able to try:
select nextval('t_temp_output_product_id_seq');

If this works, you might want to try to above method again. If not then try the below method.

You mentioned that you were able to get all of the values into t_temp_final.
The only problem was that your product key was null correct. Maybe this will work:

update t_temp_final
set product_id = nextval('t_temp_output_product_id_seq')
where product_id is null;

Hope one of these solutions works.

Regards,

Richard Broersma Jr.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message roy simkes 2006-06-27 08:36:23 Insert more then one row
Previous Message Hoványi Dániel 2006-06-26 22:54:57 Signal problems