I just encountered an old bug ("Column count doesn't match value count at row 1") that occurs when your OpenMRS database schema contains an extra column that the application is not aware of. This occurs (for me) when I use the sync data model (most tables have an extra column for GUID) with the latest version of the OpenMRS application.
If you see an error like the following, it's due to the fact that there's SQL that uses SELECT or INSERT without explicitly referring to columns by name.
ERROR - HibernateContextDAO.checkCoreDataset(304) |2008-07-09 14:02:11,203| Error while setting core privileges
java.sql.SQLException: Column count doesn't match value count at row 1
The problem occurs due to the following SQL statements:
psSelect = conn.prepareStatement("SELECT * FROM role WHERE UPPER(role) = UPPER(?)");
psInsert = conn.prepareStatement("INSERT INTO role VALUES (?, ?)");
THE POINT: This particular bug should not concern most developers as you're most likely using the most current version of the data model (which is consistent with the source code). In other words, if you're not using sync then you probably won't run into these issues.
However, I just wanted to remind all developers to make all column references explicit (see below). That should help keep this issue from popping up and will also improve performance of those queries (albeit, only slightly)
psSelect = conn.prepareStatement("SELECT role, description FROM role WHERE UPPER(role) = UPPER(?)");
psInsert = conn.prepareStatement("INSERT INTO role (role, description) VALUES (?, ?)");