Position() Bug ? In PostgreSQL 9.2

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Position() Bug ? In PostgreSQL 9.2
Date: 2013-05-02 13:25:28
Message-ID: CA+HiwqGtPyWvrFq0jD6rh7XmGMstCQBrkSrHBBz=Nd9yK-QcwQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Browse pgsql-general by date

  From Date Subject
Next Message Amit Langote 2013-05-02 13:32:16 Re: Position() Bug ? In PostgreSQL 9.2
Previous Message dinesh kumar 2013-05-02 12:09:23 Position() Bug ? In PostgreSQL 9.2