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 6331697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:07:10+00:00 2026-05-24T18:07:10+00:00

I have a postgresql database which look like the following : +—————+—————- ——+———— —+

  • 0

I have a postgresql database which look like the following :

+---------------+---------------- ------+------------ ---+
|  id (bigint)  |  name (varying(255))  |  price (real)  |
+---------------+---------------- ------+------------ ---+
|       1       |          name 1       |        0.33    |
+---------------+---------------- ------+------------ ---+
|       1       |          name 2       |        1.33    |
+---------------+---------------- ------+------------ ---+
|       1       |          name 3       |        1       |
+---------------+---------------- ------+------------ ---+

And then the results of my queries :

SELECT * FROM my_table WHERE price = 1    -- OK (one row returned)
SELECT * FROM my_table WHERE price = 1.0  -- OK (one row returned)
SELECT * FROM my_table WHERE price = 1.33 -- FAIL (no row returned)
SELECT * FROM my_table WHERE price = 0.33 -- FAIL (no row returned)

When the value can’t be cast to an non-floating value no lines are returned by postgresql.

I can’t figure out why. Have you the same problem ? How can I fix this ?

  • 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-05-24T18:07:11+00:00Added an answer on May 24, 2026 at 6:07 pm

    One solution I see is to use explicit cast to real datatype:

    SELECT * FROM my_table WHERE price = 0.33::real;
     id |  name  | price 
    ----+--------+-------
      1 | name 1 |  0.33
    
    SELECT * FROM my_table WHERE price = 1.33::real;
     id |  name  | price 
    ----+--------+-------
      1 | name 2 |  1.33
    

    According to documentation:

    A numeric constant that contains neither a decimal point nor an
    exponent is initially presumed to be type integer if its value fits in
    type integer (32 bits); otherwise it is presumed to be type bigint if
    its value fits in type bigint (64 bits); otherwise it is taken to be
    type numeric. Constants that contain decimal points and/or exponents
    are always initially presumed to be type numeric.

    Note that:

    SELECT 1.33::numeric = 1.33::real;
     ?column? 
    ----------
     f
    (1 row)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Postgresql database on which I want to do a few cascading
Right now I have a database (about 2-3 GB) in PostgreSQL, which serves as
I have a name of table or view in PostgreSQL database and need to
I have a column in the PostgreSQL database which contains Arabic data. When reading
I have a Spring application which uses Hibernate on a PostgreSQL database. I'm trying
I have a PostgreSQL\PostGIS spatial database which contains Hebrew text columns. The system runs
I have a postgresql database I would like to convert to UTF-8. The problem
I have an application server which connects to a database server. I would like
I have a PostgreSQL (9.0) database with a column card_id which is currently of
I have to connect to a legacy postgres database which has ENCODING = 'SQL_ASCII';

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.