BUG #1903: result incorrect when function max() in table with inherit used - Mailing list pgsql-bugs

From Cesar Paipilla
Subject BUG #1903: result incorrect when function max() in table with inherit used
Date
Msg-id 20050921164007.2BF32F0FC1@svr2.postgresql.org
Whole thread Raw
Responses Re: BUG #1903: result incorrect when function max() in table with inherit used
List pgsql-bugs
The following bug has been logged online:

Bug reference:      1903
Logged by:          Cesar Paipilla
Email address:      capix.999@gmail.com
PostgreSQL version: 8.1 Beta2
Operating system:   Mandrake 2006RC2
Description:        result incorrect when  function max() in table with
inherit used
Details:

result from :

 select max(id_info)
 from t_test;

is different from :

 select id_info
 from t_test
 order by id_info desc
 limit 1;


definition table t_test
                      Table "public.t_test"
       Column        |  Type   |                                 Modifiers
---------------------+---------+--------------------------------------------
--------------------------------
 id_info             | integer | not null default
nextval('public.t_test_id_info_seq'::text)
 descripcion         | text    |
Indexes:
    "t_test_pkey" PRIMARY KEY, btree (id_info)


... Definition other tables with inherits to t_test

                               Table "public.t_test_inherits_1"
       Column        |  Type   |                                 Modifiers
---------------------+---------+--------------------------------------------
--------------------------------
 id_info             | integer | not null default
nextval('public.t_test_inherits_1_id_info_seq'::text)
 descripcion         | text    |
 id_parent           | integer |
Indexes:
    "t_test_inherits_1_pkey" PRIMARY KEY, btree (id_info)
Foreign-key constraints:
    "t_test_inherits_1_id_parent_fkey" FOREIGN KEY (id_parent) REFERENCES
t_test(id_info) ON UPDATE CASCADE ON DELETE CASCADE
Inherits: t_test

DATA :

 public.t_test
 id_info |          descripcion
---------+--------------------------------
       1 | Row 1 from table "t_test"
       2 | Row A from table with inherits
       3 | Row B from table with inherits
(3 rows)

 public.t_test_inherit_1
 id_info |          descripcion           | id_parent
---------+--------------------------------+------------
       2 | Row A from table with inherits |          1
       3 | Row B from table with inherits |          1
(2 rows)

--
SELECT max(id_info)
FROM t_test;

 max
-----
   1
(1 row)

--
SELECT id_info
FROM t_test
ORDER BY id_info DESC
LIMIT 1;

 id_info
---------
       2
(1 row)

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: problem start database
Next
From: "Eder de Oliveira"
Date:
Subject: BUG #1902: Error connect