Patent attributes
A database-management system provides sargable evaluation for query predicates that compare an “LHS” encrypted database-column operand to an “RHS” expression operand. The system directly compares the two operands if all their attributes match. If the operands are encrypted string-type values differing only in length, the system truncates the RHS or pads it with encrypted blanks and, if a truncation loses meaningful data, evaluates the predicate as never satisfying an equality condition. In all other cases, if all attributes of a plaintext RHS don't match those of the plaintext data encoded into the LHS column, the system attempts to cast the RHS to match the plaintext LHS data. An error condition or data loss at this step allows the system to sargably evaluate the predicate without further analysis, but if the casting is successful and error-free, the system encrypts the resulting RHS and performs a sargable predicate evaluation.