~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-security

« back to all changes in this revision

Viewing changes to src/backend/access/heap/tuptoaster.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 *
9
9
 *
10
10
 * IDENTIFICATION
11
 
 *        $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.92 2009/01/01 17:23:35 momjian Exp $
 
11
 *        $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.93 2009/06/11 14:48:54 momjian Exp $
12
12
 *
13
13
 *
14
14
 * INTERFACE ROUTINES
1073
1073
        Assert(!VARATT_IS_COMPRESSED(DatumGetPointer(value)));
1074
1074
 
1075
1075
        /*
1076
 
         * No point in wasting a palloc cycle if value size is out of the
1077
 
         * allowed range for compression
 
1076
         * No point in wasting a palloc cycle if value size is out of the allowed
 
1077
         * range for compression
1078
1078
         */
1079
1079
        if (valsize < PGLZ_strategy_default->min_input_size ||
1080
1080
                valsize > PGLZ_strategy_default->max_input_size)
1087
1087
         * because it might be satisfied with having saved as little as one byte
1088
1088
         * in the compressed data --- which could turn into a net loss once you
1089
1089
         * consider header and alignment padding.  Worst case, the compressed
1090
 
         * format might require three padding bytes (plus header, which is included
1091
 
         * in VARSIZE(tmp)), whereas the uncompressed format would take only one
1092
 
         * header byte and no padding if the value is short enough.  So we insist
1093
 
         * on a savings of more than 2 bytes to ensure we have a gain.
 
1090
         * format might require three padding bytes (plus header, which is
 
1091
         * included in VARSIZE(tmp)), whereas the uncompressed format would take
 
1092
         * only one header byte and no padding if the value is short enough.  So
 
1093
         * we insist on a savings of more than 2 bytes to ensure we have a gain.
1094
1094
         */
1095
1095
        if (pglz_compress(VARDATA_ANY(DatumGetPointer(value)), valsize,
1096
1096
                                          (PGLZ_Header *) tmp, PGLZ_strategy_default) &&
1130
1130
        struct
1131
1131
        {
1132
1132
                struct varlena hdr;
1133
 
                char            data[TOAST_MAX_CHUNK_SIZE];     /* make struct big enough */
 
1133
                char            data[TOAST_MAX_CHUNK_SIZE]; /* make struct big enough */
1134
1134
                int32           align_it;       /* ensure struct is aligned well enough */
1135
1135
        }                       chunk_data;
1136
1136
        int32           chunk_size;
1295
1295
 
1296
1296
        /*
1297
1297
         * Find all the chunks.  (We don't actually care whether we see them in
1298
 
         * sequence or not, but since we've already locked the index we might
1299
 
         * as well use systable_beginscan_ordered.)
 
1298
         * sequence or not, but since we've already locked the index we might as
 
1299
         * well use systable_beginscan_ordered.)
1300
1300
         */
1301
1301
        toastscan = systable_beginscan_ordered(toastrel, toastidx,
1302
1302
                                                                                   SnapshotToast, 1, &toastkey);
1598
1598
         */
1599
1599
        nextidx = startchunk;
1600
1600
        toastscan = systable_beginscan_ordered(toastrel, toastidx,
1601
 
                                                                                   SnapshotToast, nscankeys, toastkey);
 
1601
                                                                                 SnapshotToast, nscankeys, toastkey);
1602
1602
        while ((ttup = systable_getnext_ordered(toastscan, ForwardScanDirection)) != NULL)
1603
1603
        {
1604
1604
                /*