Skip site navigation (1) Skip section navigation (2)

BUG #2704: pg_class.relchecks overflow problem

From: "Toru SHIMOGAKI" <shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2704: pg_class.relchecks overflow problem
Date: 2006-10-18 00:35:39
Message-ID: 200610180035.k9I0ZdEl075100@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackerspgsql-patches
The following bug has been logged online:

Bug reference:      2704
Logged by:          Toru SHIMOGAKI
Email address:      shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp
PostgreSQL version: 8.1.4
Operating system:   Red Hat Enterprise Linux AS 4
Description:        pg_class.relchecks overflow problem
Details: 

Hi, 

pg_class.relchecks is defined as int2. But the upper bound of this value is
not checked and it overflows.


I found it at the following case:

1. I tried to add check constraints:

"alter table test_a add check (aaa > i);" (0 <= i <= 32767)


2. When I added the 32768th check constraint, the value of pg_class.relchecs
became -32768.

postgres=# alter table test_a add check ( aaa > 32768 );
ALTER TABLE
postgres=# select relname, relchecks from pg_class where relname =
'test_a';
relname | relchecks
---------+-----------
test_a | -32768
(1 row)


3. The following error message was found when I added the next one:

postgres=# alter table test_a add check ( aaa > 32769 );
ERROR: unexpected constraint record found for rel test_a
postgres=# select relname, relchecks from pg_class where relname =
'test_a';
relname | relchecks
---------+-----------
test_a | -32768
(1 row)


Best regards,

Responses

pgsql-hackers by date

Next:From: Robert TreatDate: 2006-10-18 02:18:52
Subject: Re: [HACKERS] Hints proposal
Previous:From: Douglas ToltzmanDate: 2006-10-18 00:30:01
Subject: 8.1.4 verified on Intel Mac OS 10.4.8

pgsql-bugs by date

Next:From: Joe ConwayDate: 2006-10-18 10:00:24
Subject: Re: BUG #2694: Memory allocation error when selecting array
Previous:From: David BegleyDate: 2006-10-17 23:58:27
Subject: BUG #2703: Cosmetic documentation error

pgsql-patches by date

Next:From: Magnus HaganderDate: 2006-10-18 20:56:00
Subject: Contrib Makefiles
Previous:From: Bruce MomjianDate: 2006-10-17 12:53:04
Subject: Re: Constraint trigger doc patch

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group