Since switching to Postgres, I have gone through our database tables and fixed primary keys that were based on text fields to use integer fields. That went smoothly. We did have a few tables that were already using integers for pk’s so not maintenance was necessary. We have a table that stores images we use for buttons. This was one of the tables I didn’t have to mess with. I know I’ve added rows to this table since the database switch, but for some reason today when I try to add a new record I get this error:
Cannot save form data
> com.servoy.j2db.dataprocessing.DataException: ERROR: duplicate key value violates unique constraint "buttons_pkey"
Here is a copy of my server log:
2010-12-01 10:07 AWT-EventQueue-0 ERROR com.servoy.j2db.util.Debug Throwable
com.servoy.j2db.ApplicationException: Cannot save form data
at com.servoy.j2db.dataprocessing.EditRecordList.stopEditing(EditRecordList.java:598)
at com.servoy.j2db.dataprocessing.EditRecordList.stopEditing(EditRecordList.java:165)
at com.servoy.j2db.smart.dataui.DataRenderer$1.mouseReleased(DataRenderer.java:112)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: com.servoy.j2db.dataprocessing.DataException: ERROR: duplicate key value violates unique constraint "buttons_pkey"
at com.servoy.j2db.dblayer.Zb.Za(Zb.java:119)
at com.servoy.j2db.server.Zc.Zo.Za(Zo.java:442)
at com.servoy.j2db.dataprocessing.Zu.performUpdates(Zu.java:396)
at com.servoy.j2db.dataprocessing.EditRecordList.stopEditing(EditRecordList.java:464)
... 22 more
2010-12-01 10:07 AWT-EventQueue-0 ERROR com.servoy.j2db.util.Debug Error executing sql: insert into buttons (bgcolor, fgcolor, enabled, tooltiptext, transparent, visible, buttonname, font, bgcolor_field, mainimagehtml, mainimage, pressedimage, pressedimagehtml, mainimageurl, mainimagecalc) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) with params: [NullValue with type: 12 ,type: com.servoy.j2db.dataprocessing.ValueFactory$NullValue, NullValue with type: 12 ,type: com.servoy.j2db.dataprocessing.ValueFactory$NullValue, NullValue with type: 4 ,type: com.servoy.j2db.dataprocessing.ValueFactory$NullValue, NullValue with type: 12 ,type: com.servoy.j2db.dataprocessing.ValueFactory$NullValue, NullValue with type: 4 ,type: com.servoy.j2db.dataprocessing.ValueFactory$NullValue, NullValue with type: 4 ,type: com.servoy.j2db.dataprocessing.ValueFactory$NullValue, NullValue with type: 12 ,type: com.servoy.j2db.dataprocessing.ValueFactory$NullValue, NullValue with type: 12 ,type: com.servoy.j2db.dataprocessing.ValueFactory$NullValue, NullValue with type: 12 ,type: com.servoy.j2db.dataprocessing.ValueFactory$NullValue, '<html><head></head><body><p style="margin-top: 0"><img src="media:///servoy_blobloader?servername=eclinic&tablename=buttons&dataprovider=mainimage&rowid=DbIdentValue26222912"></p></body></html>' ,type: java.lang.String, NullValue with type: -2 ,type: com.servoy.j2db.dataprocessing.ValueFactory$NullValue, NullValue with type: -2 ,type: com.servoy.j2db.dataprocessing.ValueFactory$NullValue, '<html><head></head><body><p style="margin-top: 0"><img src="media:///servoy_blobloader?servername=eclinic&tablename=buttons&dataprovider=pressedimage&rowid=DbIdentValue26222912"></p></body></html>' ,type: java.lang.String, 'media:///servoy_blobloader?servername=eclinic&tablename=buttons&dataprovider=mainimage&rowid=DbIdentValue26222912' ,type: java.lang.String, NullValue with type: -2 ,type: com.servoy.j2db.dataprocessing.ValueFactory$NullValue]
org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "buttons_pkey"
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1525)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1309)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:308)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.servoy.j2db.Za.Za.Zf.invoke(Zf.java:15)
at $Proxy1.executeUpdate(Unknown Source)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at com.servoy.j2db.dataprocessing.Zu.performUpdates(Zu.java:933)
at com.servoy.j2db.dataprocessing.EditRecordList.stopEditing(EditRecordList.java:464)
at com.servoy.j2db.dataprocessing.EditRecordList.stopEditing(EditRecordList.java:165)
at com.servoy.j2db.smart.dataui.DataRenderer$1.mouseReleased(DataRenderer.java:112)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
We’re using Servoy 5.2.1 and Postgres 8.4. Any help is appreciated.