Re: problem with plpgsql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: problem with plpgsql
Дата
Msg-id 8769.998320531@sss.pgh.pa.us
обсуждение исходный текст
Ответ на problem with plpgsql  (Pascal Bourguignon <pjb@informatimago.com>)
Ответы Re: problem with plpgsql  (Pascal Bourguignon <pjb@informatimago.com>)
Список pgsql-bugs
Pascal Bourguignon <pjb@informatimago.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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Andreas Wernitznig
Дата:
Сообщение: low performance
Следующее
От: grant
Дата:
Сообщение: Re: low performance