<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><DIV></DIV>
<DIV>Yes, after the other response, I discovered that mention in db_add_field. I changed it and had other problems, not with the hook_update_N, but uninstalled and re-installed the module (so bypassed the update) and it's fine. Now I have to restore the tables and try the update again knowing that the code is good.<BR>&nbsp;</DIV>
<P><FONT face="bookman old style, new york, times, serif" color=#ff007f size=4><EM><STRONG>Nancy</STRONG></EM></FONT>&nbsp;</P>
<P><FONT face="arial, helvetica, sans-serif">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.</FONT></P>
<DIV><BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: arial, helvetica, sans-serif"><BR>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: arial, helvetica, sans-serif"><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Steven Jones &lt;steven.jones@computerminds.co.uk&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> development@drupal.org<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Sun, September 26, 2010 3:20:33 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [development] Adding auto-increment to an existing table<BR></FONT><BR>Hi Nancy,<BR><BR>The API documentation for db_change_field does let you know that<BR>serial fields need special handling, in the description of the<BR>optional $new_keys argument (incorrectly documented as the $keys_new<BR>argument). It points to db_change_field for more documentation on why:<BR>http://api.drupal.org/api/function/db_change_field<BR>which has a code example for exactly what you are trying to do I think.<BR><BR>Good luck!<BR><BR>Regards<BR>Steven Jones<BR>ComputerMinds ltd - Perfect Drupal Websites<BR><BR>Phone : 024 7666 7277<BR>Mobile :
 07702 131 576<BR>Twitter : darthsteven<BR>http://www.computerminds.co.uk<BR><BR><BR><BR>On 25 September 2010 00:51, nan wich &lt;<A href="mailto:nan_wich@bellsouth.net" ymailto="mailto:nan_wich@bellsouth.net">nan_wich@bellsouth.net</A>&gt; wrote:<BR>&gt; Thanks, I'll look at your idea. As a very remote option, I don't think any<BR>&gt; of the data is critical yet, so I may be able to find a slow time and just<BR>&gt; uninstall the module and re-install it.<BR>&gt;<BR>&gt; And, no it doesn't need to run on Postgres, but I thought these new<BR>&gt; functions for 6.x were supposed to work with both.<BR>&gt;<BR>&gt;<BR>&gt; Nancy<BR>&gt;<BR>&gt; Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King,<BR>&gt; Jr.<BR>&gt;<BR>&gt; ________________________________<BR>&gt; From: Sascha Grossenbacher &lt;<A href="mailto:saschagros@gmail.com" ymailto="mailto:saschagros@gmail.com">saschagros@gmail.com</A>&gt;<BR>&gt; To: <A
 href="mailto:development@drupal.org" ymailto="mailto:development@drupal.org">development@drupal.org</A><BR>&gt; Sent: Fri, September 24, 2010 4:29:24 PM<BR>&gt; Subject: Re: [development] Adding auto-increment to an existing table<BR>&gt;<BR>&gt; Hi<BR>&gt;<BR>&gt; On Fri, Sep 24, 2010 at 10:02 PM, nan wich &lt;<A href="mailto:nan_wich@bellsouth.net" ymailto="mailto:nan_wich@bellsouth.net">nan_wich@bellsouth.net</A>&gt; wrote:<BR>&gt;&gt; user warning: Incorrect table definition; there can be only one auto<BR>&gt;&gt; column<BR>&gt;&gt; and it must be defined as a key query: update_sql /* admin : update_sql */<BR>&gt;&gt; ALTER TABLE client_activity ADD `id` INT auto_increment DEFAULT NULL in<BR>&gt;&gt; C:\www\webapps\drupal6\includes\database.mysql-common.inc on line 298.<BR>&gt;<BR>&gt; Try using the $new_keys argument of db_change_field() to create the<BR>&gt; primary key at the same time. If that doesn't work either (possible if<BR>&gt; it does it
 in a separate query), then do not remove the primary key<BR>&gt; before making the field autoincrement.<BR>&gt;<BR>&gt; Also, if you need to do that and this code needs to run on PostgreSQL<BR>&gt; too, then you need to make it conditional and only remove/re-add the<BR>&gt; key for PostgreSQL.<BR>&gt;<BR>&gt; Sascha<BR>&gt;<BR></DIV></DIV></div></body></html>