Re: GIST and TOAST - Mailing list pgsql-hackers

From Teodor Sigaev
Subject Re: GIST and TOAST
Date
Msg-id 45EDB6CD.5030005@sigaev.ru
Whole thread Raw
In response to Re: GIST and TOAST  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: GIST and TOAST  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
> It doesn't actually crash, it just fails CHECKARRVALID. I added an assertion
> in there to cause it to generate a core dump.

Wow, catch that, see attached patch.

g_int_decompress doesn't returns detoasted array in case it was empty.
Previously it was safe because empty array never has been toasted.

Should I commit it or you'll include in your patch?

--
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/
*** ./contrib/intarray.orig/./_int_gist.c    Tue Mar  6 20:59:23 2007
--- ./contrib/intarray/./_int_gist.c    Tue Mar  6 21:41:54 2007
***************
*** 232,238 ****
--- 232,247 ----

      CHECKARRVALID(in);
      if (ARRISVOID(in))
+     {
+         if (in != (ArrayType *) DatumGetPointer(entry->key)) {
+             retval = palloc(sizeof(GISTENTRY));
+             gistentryinit(*retval, PointerGetDatum(in),
+                 entry->rel, entry->page, entry->offset, FALSE);
+             PG_RETURN_POINTER(retval);
+         }
+
          PG_RETURN_POINTER(entry);
+     }

      lenin = ARRNELEMS(in);


pgsql-hackers by date:

Previous
From: Dave Cramer
Date:
Subject: Re: [JDBC] Plan invalidation vs. unnamed prepared statements
Next
From: Heikki Linnakangas
Date:
Subject: Re: Bug: Buffer cache is not scan resistant