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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers pgsql-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

Browse pgsql-bugs by date

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

Browse pgsql-hackers by date

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

Browse pgsql-patches by date

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