Re: 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, pgsql-patches(at)postgresql(dot)org
Subject: Re: BUG #2704: pg_class.relchecks overflow problem
Date: 2006-10-25 00:28:57
Message-ID: 453EAFC9.5090203@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers pgsql-patches


How about this patch?

Of course, it might be a rare case that such check is necessary...

Toru SHIMOGAKI wrote:
> 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,
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
>

--
Toru SHIMOGAKI<shimogaki(dot)toru(at)oss(dot)ntt(dot)co(dot)jp>

Attachment Content-Type Size
relchecks.patch text/plain 666 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas H. 2006-10-25 11:16:27 8.2b2: update.bad in windows release points to wrong .msi
Previous Message Jeff Davis 2006-10-24 22:32:05 Re: Bug related to out of memory condition (more information)

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Frost 2006-10-25 00:38:06 Re: [HACKERS] Replication documentation addition
Previous Message Bruce Momjian 2006-10-25 00:16:06 Re: [HACKERS] Replication documentation addition

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2006-10-25 07:07:35 Re: Tablespace for temporary objects and sort files
Previous Message Albert Cervera Areny 2006-10-24 22:45:48 Tablespace for temporary objects and sort files