[Qt-interest] QSqlRecord pqsql & INSERT

Jan janusius at gmx.net
Thu Dec 24 02:06:56 CET 2009


Hi,

I am trying to insert a record into a QSqlTableModel (Postgres DB Table).
The first column is a serial primary key. setRecord and submitAll fails 
with the message that the serial unique constraint failed.
I tried to set the record's field to setAutoValue(true) or 
setGenerated(false) but it always failed.

The postgres docs say I could use DEFAULT in an insert statement. But if 
I use DEFAULT in the record it is treated as a string.

Does anyone know how I could insert a record with a serial field?

Jan



More information about the Qt-interest-old mailing list