Re: Table Merge Successful, Primary Keys Missing

Поиск
Список
Период
Сортировка
От Richard Broersma Jr
Тема Re: Table Merge Successful, Primary Keys Missing
Дата
Msg-id 20060627005824.10362.qmail@web31806.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на Re: Table Merge Successful, Primary Keys Missing  (<operationsengineer1@yahoo.com>)
Список 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 по дате отправления:

Предыдущее
От:
Дата:
Сообщение: Re: Table Merge Successful, Primary Keys Missing
Следующее
От: "roy simkes"
Дата:
Сообщение: insert more than one rows