trying to concat in the RAISE() function using || results in a syntax error

前端 未结 1 1010
清酒与你
清酒与你 2020-12-12 04:32

relevant documentation

I am trying to create a trigger that catches inserts into the Viewings table where the foreign key (viewings.location) does not correspond to

相关标签:
1条回答
  • 2020-12-12 04:54

    In the SQLite grammar, the second parameter of the RAISE() expression is not a string but a name:

    RAISE(ABORT, some_error)
    

    Identifiers can be quoted with double quotes, and for historical reasons, SQLite accepts a string (with single quotes) where an identifier is expected, but then it must be a single string, not a string expression composed of other values:

    RAISE(ABORT, "some error")
    

    There is no mechanism to get a dynamic value into the error message, except by creating a user-defined function for this.

    0 讨论(0)
提交回复
热议问题