Mark Constable <[EMAIL PROTECTED]> writes:
> uid is an email address stored in the passwd table as [EMAIL PROTECTED]
> and this construct allows an incoming username such as "user.domain.com"
> to be compared to the stored "[EMAIL PROTECTED]".
> SELECT wpath FROM passwd WHERE uid="\L" OR 
> insert(uid,instr(uid,'@'),1,'.')="\L"

Well, if you want to write it exactly that way you'd need to write
insert() and instr() functions, which would probably take about five
minutes in any reasonably decent string-mashing language such as plperl.
You could do it in plpgsql but it'd be more painful.  (There's an
example of coding instr() in the back of the plpgsql manual chapter,
but it's intended to match Oracle's version of instr() which might not
be quite like MySQL's.)

But, if you're not wedded to that particular way, why not use replace()?

SELECT wpath FROM passwd WHERE uid="\L" OR replace(uid, '@', '.')="\L"

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to