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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general