Unexpected SQL error for UPDATE
От | aurora |
---|---|
Тема | Unexpected SQL error for UPDATE |
Дата | |
Msg-id | cbd177510607111747h7542382bke12a6fc152338fe6@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Unexpected SQL error for UPDATE
Re: Unexpected SQL error for UPDATE |
Список | pgsql-sql |
Originally I have a table like this<br /><br /><br />create table users ( <br /> userid integer not null, <br /> email_addressvarchar (255) unique not null,<br /> PRIMARY KEY (userid) <br /> ); <br /><br /><br />Later I find that varchar(255)is not enough. I designed to change the type to<br />text. There is no simple SQL to alter the type. So I usea series of SQLs to<br />create a new column, copy the data over and then replace the old column with the <br />new.<br/><br /> ALTER TABLE users ADD email_address_text text UNIQUE; <br />UPDATE users set email_address_text=email_address;<br/>ALTER TABLE users DROP email_address;<br />ALTER TABLE users RENAME email_address_textTO email_address;<br />ALTER TABLE users ALTER email_address SET not null;<br /><br /><br />This worksmostly OK. Until I have one database that has over 1 million records<br />in table user. It fails with an inexplicableerror:<br /><br /><br />mydb=# UPDATE users set email_address_text=email_address;<br />ERROR: invalid page headerin block 6776 of relation "users_email_address_text_key" <br /><br /><br />Anyone can shred some light what has wentwrong?<br /><br />wy<br /><br /><br /><br />
В списке pgsql-sql по дате отправления: