IMHO, this is mainly a normalization problem. A column named "id" does not uniquely address a row, so it can never be PK. At least a new (surrogate) key (element) is required. The constraint itself cannot be expressed as an expression "inside the string", so it must be expressed through FK.
Thus, it is divided into two tables: One with PK = id and FK REFERENCING two.sid
Two with PK = surrogate key and FK id LINKS one.id The original value of the "payload" is also used here.
The βone bit variableβ disappears because it can be expressed in EXISTS terms. (effectively, table one points to a string containing a token)
[I expect that the Postgres rule system can be used to use the above two-table model to emulate the alleged behavior of the OP. But that would be an ugly hack ...]
EDIT / UPDATE:
Postgres supports partial / conditional indexes. (don't know about ms-sql)
DROP TABLE tmp.one; CREATE TABLE tmp.one ( sid INTEGER NOT NULL PRIMARY KEY
source share