Re: Table Merge Successful, Primary Keys Missing - Mailing list pgsql-novice

From Richard Broersma Jr
Subject Re: Table Merge Successful, Primary Keys Missing
Date
Msg-id 20060627005824.10362.qmail@web31806.mail.mud.yahoo.com
Whole thread Raw
In response to Re: Table Merge Successful, Primary Keys Missing  (<operationsengineer1@yahoo.com>)
List 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.

pgsql-novice by date:

Previous
From:
Date:
Subject: Re: Table Merge Successful, Primary Keys Missing
Next
From: "roy simkes"
Date:
Subject: insert more than one rows