Re: Position() Bug ? In PostgreSQL 9.2

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dinesh kumar <dineshkumar02(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Position() Bug ? In PostgreSQL 9.2
Date: 2013-05-02 13:49:38
Message-ID: 23390.1367502578@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

dinesh kumar <dineshkumar02(at)gmail(dot)com> writes:
> postgres=# select position('' in 'PostgreSQL'); *// position(Substring as
> an empty string) is returning 1.*
> position
> ----------
> 1
> (1 row)

This is correct according to the SQL standard:

<position expression> determines the first position, if any, at
which one string, S1, occurs within another, S2. If S1 is of length
zero, then it occurs at position 1 (one) for any value of S2. If S1
does not occur in S2, then zero is returned.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

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