Home > Mobile >  How to query the NaN values from an integer column in a Postgresql Database
How to query the NaN values from an integer column in a Postgresql Database

Time:10-17

I have a table in my PostgreSQL DB in which I have a numbers column. I want to query all the rows where the numbers column is a NaN. When I try do so with SELECT * FROM my_table WHERE numbers='NaN' I get the following error message : ERROR: invalid input syntax for type integer: "NaN" I am using the Command line tool psql (PostgreSQL) 14.5 (Homebrew) What am I doing wrong ? Thanks

CodePudding user response:

Integer columns in PostgresSQL cannot have NaN values. Those are limited to Numeric and Floating Point types. So the message is quite clear, that the syntax is invalid for Integer types.

  • Related