Pascal Bourguignon <pjb(at)informatimago(dot)com> writes:
> I'm trying to write a function to either insert a new row, or update
> an existing row. However, the test "if not found" is always true,
I believe you're getting burnt by the fact that lim.login is declared
as char(8) --- so it has trailing blanks --- whereas the first parameter
of lim_update is declared as text --- so it doesn't have trailing
blanks. What's more, the comparison login=plogin will be done under
"text" rules wherein trailing blanks are significant. So 'pjb' is not
equal to 'pjb '.
The ip and mac columns have the same problem.
Advice: don't use char(n) for data that's not really fixed-width.
regards, tom lane