mirror of
https://github.com/postgres/postgres.git
synced 2025-11-22 12:22:45 +03:00
Fix interaction of TOAST compression with expression indexes.
Before, trying to compress a value for insertion into an expression index would crash. Dilip Kumar, with some editing by me. Report by Jaime Casanova. Discussion: http://postgr.es/m/CAJKUy5gcs0zGOp6JXU2mMVdthYhuQpFk=S3V8DOKT=LZC1L36Q@mail.gmail.com
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "access/relscan.h"
|
||||
#include "access/sysattr.h"
|
||||
#include "access/tableam.h"
|
||||
#include "access/toast_compression.h"
|
||||
#include "access/transam.h"
|
||||
#include "access/visibilitymap.h"
|
||||
#include "access/xact.h"
|
||||
@@ -379,6 +380,15 @@ ConstructTupleDescriptor(Relation heapRelation,
|
||||
to->attalign = typeTup->typalign;
|
||||
to->atttypmod = exprTypmod(indexkey);
|
||||
|
||||
/*
|
||||
* For expression columns, set attcompression invalid, since
|
||||
* there's no table column from which to copy the value. Whenever
|
||||
* we actually need to compress a value, we'll use whatever the
|
||||
* current value of default_compression_method is at that point
|
||||
* in time.
|
||||
*/
|
||||
to->attcompression = InvalidCompressionMethod;
|
||||
|
||||
ReleaseSysCache(tuple);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user