On Thu, Nov 14, 2019 at 03:27:42PM +0530, Rushabh Lathia wrote: >Today I noticed strange behaviour, consider the following test: > >postgres@126111=#create table foo ( a text ); >CREATE TABLE >postgres@126111=#insert into foo values ( repeat('PostgreSQL is the >world''s best database and leading by an Open Source Community.', 8000)); >INSERT 0 1 > >postgres@126111=#select substring(a from 639921 for 81) from foo; > substring >----------- > >(1 row) >
Hmmm. I think the issue is heap_tuple_untoast_attr_slice is using the wrong way to determine compressed size in the VARATT_IS_EXTERNAL_ONDISK branch. It does this