Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8577617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:12:00+00:00 2026-06-11T20:12:00+00:00

Im trying to make a query that help me get a user by its

  • 0

Im trying to make a query that help me get a user by its username. What i want to do is to check if the given username is unique. so what i thought about is to uppercase the username when i do my select request and compare it with an uppercase of the given username. This is what i tried:

SQL("select * from utilisateur where upper(pseudo) = {pseudo}").on(
        'pseudo -> pseudo.toUpperCase
        ).as(Utilisateur.utilisateur.singleOpt) 

but it get this error:

[RuntimeException: SqlMappingError(too many rows when expecting a single one)]

I tried this too:

SQL("select * from utilisateur where ucase(pseudo) = {pseudo}").on(
        'pseudo -> pseudo.toUpperCase
        ).as(Utilisateur.utilisateur.singleOpt) 

and i got this error:

[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]

What should i do ?

PS:Im using PostgreSQL 9.1

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:12:02+00:00Added an answer on June 11, 2026 at 8:12 pm

    First, in Play!, only use singleOpt if you’re expecting exactly one row back. Otherwise, it will throw an exception. Since you do want just one row, add a LIMIT 1 to the end of your query.

    The PostgreSQL function you want is upper(). Here’s an example:

    SQL("select * from utilisateur where upper(pseudo) = {pseudo} limit 1").on(
            'pseudo -> pseudo.toUpperCase
            ).as(Utilisateur.utilisateur.singleOpt) 
    

    (You can play with it here: http://sqlfiddle.com/#!1/6226c/5)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a query that will insert multiple values from my
I'm trying to make a SPARQL query, that returns a variable which contains two
I'm trying to make a query to get rush hours for everyday on a
i'm trying to get a query that returns rows only with a specified name,
I'm trying to make a form that will take given text and direct you
I want to create a sql query that lets me make a top 5
So I'm trying to make a Chrome extension that takes in user input in
I am trying to make a query to work, but with no luck. I
I am trying to make a query to an SQL database and I can't
I'm trying to make a query, but I can't find a way to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.