[Qt-interest] QSqlTableModel NOT NULL constraints and default values

Harry Sfougaris hsfougaris at gmail.com
Thu May 13 21:08:33 CEST 2010


Hi all,
I am using a Postgres table that has some fields defined as
....
 myFld1 character varying(1024) NOT NULL DEFAULT 'my default value'::character varying, 
...
I am using a QDataWidgetMapper with a delegate that converts the data in empty text boxes to NULL instead of ''
This works with fine with other fields that don't have a NOT NULL constraint.

When I am trying to use it with a field that has a NOT NULL constraint though, upon submit() I get the error:
"ERROR: null value in column "myFld1" violates not-null constraint. QPSQL: unable to create query"

Is there a flag I can set so that the model will allow the query to go to the server, or another solution?

Thanks,


Harry Sfougaris








More information about the Qt-interest-old mailing list