Find not-integer values in a string column

postgresql, regex

Solution

Since you're looking for non-integer values, if the status contains anything that isn't a digit (i.e. a letter, decimal point, etc.), it's not an integer, so this regex should work:

select * from foo where status ~ E'[^\\d]'

Note the double-escape of the backslash and the use of the negated character class.

Here's an sqlfiddle.

Problem

How to select records which are having non-integer values in a particular column? I tried like: ``` SELECT * FROM tableName WHERE status !~ '^\d+?\$' ``` I want to find all records not storing exact integer representations. ``` Column | Type | Modifiers ------------+-----------------------+----------- status | charecter varying(25) | ```

Original source