I’m having trouble understanding the intent of the start and count arguments to SUBSTR
in the SCRUB_EMAIL
function.
I understand that we want to return the first five or more characters from the MD5
value. The PostgreSQL documentation examples indicate that string indexes start at 1, not 0. Why does the SCRUB_EMAIL
code call SUBSTR
with a starting index of 0 and a count of 6 or greater? I see that the code produces the desired outcome, but wouldn’t it be equivalent and clearer to use a starting index of 1 and a count of 5 or greater?