ユーザー名でユーザーを取得するのに役立つクエリを作成しようとしています。私がしたいのは、指定されたユーザー名が一意であるかどうかを確認することです。だから私が考えたのは、選択要求を行うときにユーザー名を大文字にして、指定されたユーザー名の大文字と比較することです。これは私が試したものです:
SQL("select * from utilisateur where upper(pseudo) = {pseudo}").on(
'pseudo -> pseudo.toUpperCase
).as(Utilisateur.utilisateur.singleOpt)
しかし、このエラーが発生します:
[RuntimeException: SqlMappingError(too many rows when expecting a single one)]
私もこれを試しました:
SQL("select * from utilisateur where ucase(pseudo) = {pseudo}").on(
'pseudo -> pseudo.toUpperCase
).as(Utilisateur.utilisateur.singleOpt)
そして私はこのエラーを受け取りました:
[PSQLException: ERROR: function ucase(character varying) does not exist Indice : No function matches the given name and argument types. You might need to add explicit type casts. Position : 33]
私は何をすべきか ?
PS:PostgreSQL9.1を使用しています