min() and max() with int8 - Mailing list pgsql-general

From Adam Buble
Subject min() and max() with int8
Date
Msg-id Pine.SO4.4.05.9902282100110.12615-100000@academy.cas.cz
Whole thread Raw
List pgsql-general
Hello,
I have some troubles using MIN and MAX aggregation functions with int8
values. If values are small (?) the functions works well, but if the size
of the number grows, or is lower than zero, it does not work well.

Example:
=> CREATE TABLE INT8_TBL(q1 int8, q2 int8);
=> INSERT INTO INT8_TBL VALUES('123','456');
=> select min(q1) from INT8_TBL;
min
---
123
(1 row)

=> INSERT INTO INT8_TBL VALUES('-123','-456');
=> select min(q1) from INT8_TBL;
min
---
  0
(1 row)

max works fine in this scenario, but it depends on values in table. Too
big numbers (but in int8 range) confuse Postgres as well.

What's wrong?

    Adam


pgsql-general by date:

Previous
From: Judy Dilworth
Date:
Subject: Does PostgreSQL support a file load function
Next
From: buble@academy.cas.cz (Adam Buble)
Date:
Subject: min() and max() with int8