rein
rein copied to clipboard
add_presence_constraint breaks when data type of column is jsonb
Encountered this bug when using rein to add a presence constraint on a column that is using the data type jsonb. Screenshot of the error message is as follows:

From looking at the source code, I believe the issue stems from the method below where there is a comparison of the column with a regex matcher checking for whitespace string characters which results in a type casting error.

Thanks @kelvintyb, maybe it doesn't make sense to add a presence constraint to a JSONB column. Apart from checking it's not null, how would you verify it is "present"?