71a72,75
>     
>     // (tp) retype id to serial and set default value in order to allow for insertion
>     db_change_field('test_table', 'id', 'id2', array('type' => 'serial', 'description' => 'Changed column description.'));
>     db_field_set_default('test_table', 'test_field', 1);
78c82,89
<     $this->assertTrue($index_exists, t('Index was renamed.'));
---
>     $this->assertTrue($index_exists, t('Index was renamed after table rename.'));
> 
>     // (tp) check that insert into serial column works after table rename
>     $this->assertTrue($this->tryInsert("test_table2", "id2", TRUE), t('Insert into serialized column after table rename succeeded.'));
> 
>     // (tp) rename and retype column
>     db_change_field('test_table2', 'id2', 'id', array('type' => 'int', 'not null' => TRUE));
>     // TODO: we cannot check from here that the pgsql sequence gets geleted
87c98
<     $this->assertEqual($count, 2, t('Two fields were successfully inserted.'));
---
>     $this->assertEqual($count, 3, t('Two fields were successfully inserted.'));
111a123,147
>     
>     // (tp) insert with existing test_serial value given, expect unique violation
>     try {
>        db_insert($table)->fields(array("id" => mt_rand(10, 20), "test_serial" => $max2))->execute();
>       $val = TRUE;
>     }
>     catch (Exception $e) {
>       $val = FALSE;
>     }
>     $this->assertFalse($val, t('Unique constraint works on primary key column.'));
>     
>     // (tp) rename test_serial to test_serial2, check that index is renamed
>     db_change_field('test_table', 'test_serial', 'test_serial2', array());
>     $index_exists = Database::getConnection()->schema()->indexExists('test_table2', 'test_field');
>     $this->assertTrue($index_exists, t('Index was renamed after column rename.'));
> 
>     // TODO: howto drop test_serial's primary key?
>     
>     // TODO: insert with same id given, expect no violation
>     
>     // TODO: drop serial character, insert with no id given, expect error
>     
>     // TODO: drop null constraint, insert with no id given, check that id is null
>     
>     // TODO: add null constraint, expect error
117c153
<   function tryInsert($table = 'test_table') {
---
>   function tryInsert($table = 'test_table', $col="id", $debug=FALSE) {
120c156
<          ->fields(array('id' => mt_rand(10, 20)))
---
>          ->fields(array($col => mt_rand(10, 20)))
124a161,162
>       if ($debug)
>         debug($e);
