Thread: BUG #1903: result incorrect when function max() in table with inherit used
BUG #1903: result incorrect when function max() in table with inherit used
From
"Cesar Paipilla"
Date:
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)
"Cesar Paipilla" <capix.999@gmail.com> writes: > Description: result incorrect when function max() in table with > inherit used Fixed --- thanks for the report! regards, tom lane