position('' in '') returns 1 instead of 0 - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject position('' in '') returns 1 instead of 0
Date
Msg-id 200104182025.f3IKPXD86278@hub.org
Whole thread Raw
Responses Re: position('' in '') returns 1 instead of 0
Re: position('' in '') returns 1 instead of 0
List pgsql-bugs
Terry Carlin (terry@greatbridge.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
downto 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
orNULL 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

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Amendment to linux rc script
Next
From: Tom Lane
Date:
Subject: Re: position('' in '') returns 1 instead of 0