dbTalk Databases Forums  

[BUGS] BUG #1903: result incorrect when function max() in table with inherit used

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1903: result incorrect when function max() in table with inherit used in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Cesar Paipilla
 
Posts: n/a

Default [BUGS] BUG #1903: result incorrect when function max() in table with inherit used - 09-21-2005 , 01:46 PM







The following bug has been logged online:

Bug reference: 1903
Logged by: Cesar Paipilla
Email address: capix.999 (AT) gmail (DOT) 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'::te xt)
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)

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.