Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Backslash and Underscore problem with DBI and PostgreSQL.

by Zaxo (Archbishop)
on Jun 21, 2004 at 04:50 UTC ( [id://368367]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Backslash and Underscore problem with DBI and PostgreSQL.
in thread Backslash and Underscore problem with DBI and PostgreSQL.

Yes, forcing to lowercase and testing equality is much better than pattern matching.

A username is probably intended to be a unique key, so if you want case insensitive matching, you should take steps to make sure that uniqueness is enforced in a case insensitive way. A rule on insert and update should be a nice way to do that in pg.

The trouble with pattern matching is that, as you found, it breaks uniqueness of a key.

After Compline,
Zaxo

  • Comment on Re^3: Backslash and Underscore problem with DBI and PostgreSQL.

Replies are listed 'Best First'.
Re^4: Backslash and Underscore problem with DBI and PostgreSQL.
by Seumas (Curate) on Jun 21, 2004 at 05:04 UTC
    Yeah, uniqueness constraints are proper going in, but somehow this has escaped me in my SELECT statement all this time that I've been using the code. I've read the DBI book by O'Reilly a number of times as well as several PostgreSQL books - but it had never occurred to me that there was an alternative to using ~* and ~~* to achieve what I was doing.

    Thank you (Zaxo and blokhead) for taking the time to answer my relatively idiotic question. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://368367]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-20 04:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found