Обсуждение: Position() Bug ? In PostgreSQL 9.2

Поиск
Список
Период
Сортировка

Position() Bug ? In PostgreSQL 9.2

От
Amit Langote
Дата:
This behavior is similar to strstr(3) ('needle in a haystack'
substring locating C function).
which is,

char *strstr(const char *haystack, const char *needle)

which returns haystack (that is main string) if needle (string to be
located) is empty.

Assuming position() tries to do something similar, it returns first
index (which is 1) of the main string (haystack!). Although this does
not answer if it's a bug or not, I tend to think it is deliberate.

--

Amit Langote