============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Cody Zilverberg
Your email address : cjzilverberg@csbsju.edu
Category : runtime: back-end: SQL
Severity : serious
Summary: UPDATE reports successful but was not
System Configuration
--------------------
Operating System : Irix
PostgreSQL version : 6.3
Compiler used :
Hardware:
---------
Versions of other tools:
------------------------
--------------------------------------------------------------------------
Problem Description:
--------------------
I created a table with 7 columns and I later added an
eighth column. When I try to update that column, PostgreSQL
reports a successful update, but fails it update the eight
column. This occurs whether I try to update a row or if I
try to insert a new row.
--------------------------------------------------------------------------
Test Case:
----------
I have a class that looks like the following. I put all of the columns in it
when I created it, except for instructorid, which I added later.
Table = class
+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| classid | int4 default nextval ( 'class_cl | 4 |
| department | varchar() | 10 |
| classname | varchar() | 25 |
| section | varchar() | 5 |
| coursenumber | varchar() | 4 |
| term | varchar() | 1 |
| year | varchar() | 4 |
| instructorid | int4 | 4 |
+----------------------------------+----------------------------------+-------+
The table's current state is this.
homework=> select * from class;
classid|department|classname |section|coursenumber|term|year|instructorid
-------+----------+---------------+-------+------------+----+----+------------
1|CS |Data Structures|001a | 200| 4|1998|
2|Bio |Anatomy |001a | 130| 2|1997|
3|Bio |Anatomy |001a | 130| 2|1996|
(3 rows)
I issue this successful command:
homework=> update class set instructorid=333 where classid=3;
UPDATE 1
and the state of the table is:
homework=> select * from class;
classid|department|classname |section|coursenumber|term|year|instructorid
-------+----------+---------------+-------+------------+----+----+------------
1|CS |Data Structures|001a | 200| 4|1998|
2|Bio |Anatomy |001a | 130| 2|1997|
3|Bio |Anatomy |001a | 130| 2|1996|
(3 rows)
homework=> select * from class where instructorid=333;
classid|department|classname|section|coursenumber|term|year|instructorid
-------+----------+---------+-------+------------+----+----+------------
(0 rows)
For some reason the instructorid is not updated. Similarly, if I try to insert
a new row, all of the new values are inserted successfully except for the
instructorid value.
--------------------------------------------------------------------------
Solution:
---------
--------------------------------------------------------------------------