Skip to content

Some formula constraint creations broken #3505

@glutamate

Description

@glutamate

Try adding this formula constraint to a table: !(name==="roderick" && phone==null) (both of these are String fields). The constraint is not added, no error message appears.

Two things are broken:

  1. it's normal that some formulae cannot be translated to SQL. Constraints are checked in javascript as well. what is meant to happen is that if the constraint is created with an untranslatable formula, the SQL errors on the ALTER TABLE ... ADD CONSTRAINT` statement, and this error is ignored. but this has probably been broken since the introduction of transactions, so now the row in _sc_table_constraints is not created at all.

  2. This formula is translated as: not (((first_name)==(roderick))and(phone is null)) - this is close but invalid SQL. Make sure string literals are in single quotes, and single = instead of ==

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions