]> granicus.if.org Git - postgresql/commitdiff
Record the proper typmod for an index expression column.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 26 Apr 2014 16:22:09 +0000 (12:22 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 26 Apr 2014 16:22:09 +0000 (12:22 -0400)
We should use exprTypmod() to extract the typmod of the expression,
instead of just blindly storing -1.  This seems to have been an aboriginal
oversight in commit fc8d970cbcdd6f025475822a4cf01dfda0873226 which
introduced general-expression indexes.  The consequences are only cosmetic
at present, since the index machinery doesn't really look at typmod for
index columns; but still it seems best to describe the column type as
precisely as we can.  Per off-list complaint from Thomas Fanghaenel.

src/backend/catalog/index.c

index 47f0647cb4128a4864c585f511b47f9632ceb414..c932c833421d512ef733f6516ec867629f0b7844 100644 (file)
@@ -389,7 +389,7 @@ ConstructTupleDescriptor(Relation heapRelation,
                        to->attalign = typeTup->typalign;
                        to->attstattarget = -1;
                        to->attcacheoff = -1;
-                       to->atttypmod = -1;
+                       to->atttypmod = exprTypmod(indexkey);
                        to->attislocal = true;
                        to->attcollation = collationObjectId[i];