You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
db.define_table('tablename, Field('fieldname, notnull=True)) triggers psycopg2.errors.NotNullViolation: column "fieldname__tmp" of relation "tablename" contains null values on PostgreSQL migrations when there is already some data in the table. It gives sense because py4web creates notnull fieldname__tmp with null values (supposed to be replaced by fieldname data in the next step).
Setting default to something else than DEFAULT serves as a workaround.
On PostgreSQL I would suggest setting notnull=False for temporary fields (*__tmp) even if the original field is notnull=True, unless there is a non-null default value specified.
David
The text was updated successfully, but these errors were encountered:
Hi,
db.define_table('tablename, Field('fieldname, notnull=True))
triggerspsycopg2.errors.NotNullViolation: column "fieldname__tmp" of relation "tablename" contains null values
on PostgreSQL migrations when there is already some data in the table. It gives sense because py4web creates notnull fieldname__tmp with null values (supposed to be replaced by fieldname data in the next step).Setting default to something else than DEFAULT serves as a workaround.
On PostgreSQL I would suggest setting notnull=False for temporary fields (*__tmp) even if the original field is notnull=True, unless there is a non-null default value specified.
David
The text was updated successfully, but these errors were encountered: