Substring function incorrect when searching for '@.'

From: "Mike G(dot)" <mike(at)thegodshalls(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Substring function incorrect when searching for '@.'
Date: 2004-10-12 22:35:17
Message-ID: 20041012223517.GA4549@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

To reproduce:

create a table with a data type of varchar (50) and name it email

insert into this table the following values:
test1(at)anyemail(dot)com

Execute the following statement:
SELECT CASE WHEN count(substring(email FROM '@.')) > 0 THEN count(substring(email FROM '@.')) ELSE 0 END, email FROM your_schema.your_table GROUP BY email;

Result with be equal to 1 / True. It should be 0 / False.

If you execute the above but replace '@.' with '@a' it will also return 1 / True is correct.

The only time it fails for me is if the @ is immediately followed by a period.

7.3.4 using psql via pgadminIII under cygwin.

Mike

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-10-12 23:00:16 Re: Substring function incorrect when searching for '@.'
Previous Message Kris Jurka 2004-10-12 21:07:07 overloaded functions and NULL