Re: Copying data from one table to another - how to specify fields?

Поиск
Список
Период
Сортировка
От Alexander Farber
Тема Re: Copying data from one table to another - how to specify fields?
Дата
Msg-id AANLkTikHL-KeDYoiMMtxTkZVJQhspCinda57Z6EHfRvS@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Copying data from one table to another - how to specify fields?  (Michael Glaesemann <michael.glaesemann@myyearbook.com>)
Ответы Re: Copying data from one table to another - how to specify fields?
Re: Copying data from one table to another - how to specify fields?
Список pgsql-general
Oh it is called "INSERT INTO", thank you!

I still have a problem though:

# select uid, name, mail, created, access from drupal_users;
 uid | name |            mail            |  created   |   access
-----+------+----------------------------+------------+------------
   0 |      |                            |          0 |          0
   1 | Alex | Alexander.Farber@gmail.com | 1299512207 | 1299751991
(2 rows)

# INSERT INTO drupal_users (uid, name, mail, created, access)
 SELECT user_id, username, user_email, user_regdate, user_lastvisit
   FROM phpbb_users
   WHERE user_id > 50 and length(username) > 0;
ERROR:  duplicate key value violates unique constraint "drupal_users_name_key"

I don't understand, what is wrong with "name" here and
how to find the troublemaking record in my 4700 lines table

# \d+ drupal_users_name_key;
          Index "public.drupal_users_name_key"
 Column |         Type          | Storage  | Description
--------+-----------------------+----------+-------------
 name   | character varying(60) | extended |
unique, btree, for table "public.drupal_users"

Using PostgreSQL 8.4.7

Thank you
Alex

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

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: Copying data from one table to another - how to specify fields?
Следующее
От: "Sandy Test"
Дата:
Сообщение: FW: backup using pg_dump postgreSQL 8.3.8