Skip to content

Problem using "real" datatype in PostgreSQL. #72

@dimag1978

Description

@dimag1978

When pisces creates database tables, the type used for non-integer fields is real. For example, this is a table - Origin:

CREATE 
TABLE IF NOT EXISTS origin
(
    lat real,
    lon real,
    depth real,
...

The use of this data type causes problems with accuracy and with the search for events at given coordinates.
For example I have an event with coordinates lat: 41.0508 lon:79.5898. I am running a query:

SELECT * FROM origin WHERE lat=41.0508 AND lon=79.5898;

which returns nothing.
If I manually change the real data type to numeric, then I find the desired event.
Floating point variables are vulnerable to floating point errors. Therefore, if accuracy is important it's always recommended to use a numeric type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions