Thread: "Compressed data is corrupt"

"Compressed data is corrupt"

From
Matthias Leisi
Date:
I have a behaviour of Postgres which I do not understand (and thus can
not fix...). When inserting into a log-like table, I get the error
message "compressed data is corrupt" for certain (rare) combination of
values. When I re-create the same table structure from scratch and
insert the same data in to that table, the error does not appear.

Situation which triggers the error:

dnswl=# \d+ requesthistory
                             Table "public.requesthistory"
     Column      |          Type          |     Modifiers      |
Storage  | Description
-----------------+------------------------+--------------------+----------+-------------
 requestip       | inet                   | not null           | main     |
 requesthostname | character varying(255) | not null           | extended |
 requestdate     | date                   | not null           | plain    |
 requestcount    | integer                | not null default 0 | plain    |
Indexes:
    "requesthistory_pkey" PRIMARY KEY, btree (requestip, requestdate)
Has OIDs: no
dnswl=# insert into requesthistory values ('209.166.168.6',
'myhostname', '2012-02-29', 23);
ERROR:  compressed data is corrupt

Situation which does not lead to the error:

dnswl=# \d+ testip
                              Table "public.testip"
  Column  |          Type          |     Modifiers      | Storage  | Description
----------+------------------------+--------------------+----------+-------------
 ip       | inet                   | not null           | main     |
 hostname | character varying(255) | not null           | extended |
 mydate   | date                   | not null           | plain    |
 count    | integer                | not null default 0 | plain    |
Indexes:
    "testip_pkey" PRIMARY KEY, btree (ip, mydate)
Has OIDs: no
dnswl=# insert into testip values ('209.166.168.6', 'myhostname',
'2012-02-29', 23);
INSERT 0 1

Changing the hostname, date or count fields does not change the
situation. Changing the IP address slightly (eg from "..6" to "..5")
makes the error disappear.

Any clue what may be going on? Any more things I should try and test?

Running Postgresql 8.4.7 on an openSuSE machine (64bit).

-- Matthias

Re: "Compressed data is corrupt"

From
Tom Lane
Date:
Matthias Leisi <matthias@leisi.net> writes:
> I have a behaviour of Postgres which I do not understand (and thus can
> not fix...). When inserting into a log-like table, I get the error
> message "compressed data is corrupt" for certain (rare) combination of
> values. When I re-create the same table structure from scratch and
> insert the same data in to that table, the error does not appear.

The most obvious theory for this is a corrupted index entry in the pkey
index.  Does the issue go away if you REINDEX?

            regards, tom lane