position('' in '') returns 1 instead of 0

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: position('' in '') returns 1 instead of 0
Date: 2001-04-18 20:25:33
Message-ID: 200104182025.f3IKPXD86278@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Terry Carlin (terry(at)greatbridge(dot)com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
position('' in '') returns 1 instead of 0

Long Description
While running an ODBC test suite against PostgreSQL 7.1, the test software reported that the ODBC command locate("", "") failed.
It expected the result to be zero and it got a 1. When I looked at what was being sent over to postgresql, it boiled down to a position('' in '') Entering the command select position(''' in '') into psql gives a 1 also.
if you also do select position('' in 'abc') it also returns 1.
This returns a 1. Since the length('') returns 0, it seems to me that position('' in '') should return either a zero or NULL as there is no position 1 in the string ''.

Sample Code
select position('' in '');

select length('');

select position('' in 'abc');

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message loganathan p 2001-04-18 21:04:44
Previous Message Bruce Momjian 2001-04-18 18:53:20 Re: Amendment to linux rc script