dbTalk Databases Forums  

[BUGS] BUG #2704: pg_class.relchecks overflow problem

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


Discuss [BUGS] BUG #2704: pg_class.relchecks overflow problem in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Toru SHIMOGAKI
 
Posts: n/a

Default [BUGS] BUG #2704: pg_class.relchecks overflow problem - 10-17-2006 , 07:36 PM







The following bug has been logged online:

Bug reference: 2704
Logged by: Toru SHIMOGAKI
Email address: shimogaki.toru (AT) oss (DOT) ntt.co.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

Reply With Quote
  #2  
Old   
Toru SHIMOGAKI
 
Posts: n/a

Default Re: [BUGS] BUG #2704: pg_class.relchecks overflow problem - 10-24-2006 , 07:53 PM






This is a multi-part message in MIME format.
--------------050304000202060408030500
Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: 7bit


How about this patch?

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


Toru SHIMOGAKI wrote:
Quote:
The following bug has been logged online:

Bug reference: 2704
Logged by: Toru SHIMOGAKI
Email address: shimogaki.toru (AT) oss (DOT) ntt.co.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.toru (AT) oss (DOT) ntt.co.jp>

--------------050304000202060408030500
Content-Type: text/plain;
name="relchecks.patch"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="relchecks.patch"

ZGlmZiAtY3ByIHBvc3RncmVzcWwtOC4xLjUtb3JpZy9zcmMvYm Fja2VuZC9j
YXRhbG9nL2hlYXAuYyBwb3N0Z3Jlc3FsLTguMS41L3NyYy9iYW NrZW5kL2Nh
dGFsb2cvaGVhcC5jCioqKiBwb3N0Z3Jlc3FsLTguMS41LW9yaW cvc3JjL2Jh
Y2tlbmQvY2F0YWxvZy9oZWFwLmMJMjAwNi0wNC0yNCAxMDo0MD ozOS4wMDAw
MDAwMDAgKzA5MDAKLS0tIHBvc3RncmVzcWwtOC4xLjUvc3JjL2 JhY2tlbmQv
Y2F0YWxvZy9oZWFwLmMJMjAwNi0xMC0yMyAxNjo1MDoyMi4wMD AwMDAwMDAg
KzA5MDAKKioqKioqKioqKioqKioqIEFkZFJlbGF0aW9uUmF3Q2 9uc3RyYWlu
dHMoUmVsYXRpb24gcmVsLAoqKiogMTUyNSwxNTMwICoqKioKLS 0tIDE1MjUs
MTUzNSAtLS0tCiAgCQkJY29udGludWU7CiAgCQlBc3NlcnQoY2 RlZi0+Y29v
a2VkX2V4cHIgPT0gTlVMTCk7CiAgCisgCQlpZiAobnVtY2hlY2 tzID09IDB4
N0ZGRikKKyAJCQllcmVwb3J0KEVSUk9SLAorIAkJCQkJKGVycm NvZGUoRVJS
Q09ERV9QUk9HUkFNX0xJTUlUX0VYQ0VFREVEKSwKKyAJCQkgIG Vycm1zZygi
Y2Fubm90IGhhdmUgbW9yZSB0aGFuIDJeMTUtMSBjaGVja3MgaW 4gYSB0YWJs
ZSIpKSk7CisgCiAgCQkvKgogIAkJICogVHJhbnNmb3JtIHJhdy BwYXJzZXRy
ZWUgdG8gZXhlY3V0YWJsZSBleHByZXNzaW9uLgogIAkJICovCg ==

--------------050304000202060408030500
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

--------------050304000202060408030500--



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.