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 AANLkTikG-t=A8DFe7CX3b1-1L4zvBjvM+ZjzX83_yNZg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Copying data from one table to another - how to specify fields?  (Alexander Farber <alexander.farber@gmail.com>)
Ответы Re: Copying data from one table to another - how to specify fields?  (Alexander Farber <alexander.farber@gmail.com>)
Список pgsql-general
I've also tried renaming 'Alex' to a temp. value:

# update drupal_users set name='Alex_1972' where name='Alex';
UPDATE 1

# 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 and username <> 'Alex';
ERROR:  duplicate key value violates unique constraint "drupal_users_name_key"

# select username, user_id from phpbb_users where exists
 (select 1 from drupal_users
   where drupal_users.name = phpbb_users.username);
 username | user_id
----------+---------
(0 rows)

so there must be a duplicated username in the source table
phpbb_users, but how could I find that record?

Thank you
Alex

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

Предыдущее
От: Andy Colson
Дата:
Сообщение: Re: Using bytea field...
Следующее
От: Alexander Farber
Дата:
Сообщение: Re: Copying data from one table to another - how to specify fields?