Re: BUG #15653: pg_detoast_datum_packed problem

Поиск
Список
Период
Сортировка
От gmail Vladimir Koković
Тема Re: BUG #15653: pg_detoast_datum_packed problem
Дата
Msg-id b47c8361-e2b2-a0a0-85e9-e17aacb8a3cb@gmail.com
обсуждение исходный текст
Ответ на Re: BUG #15653: pg_detoast_datum_packed problem  (gmail Vladimir Koković <vladimir.kokovic@gmail.com>)
Ответы Re: BUG #15653: pg_detoast_datum_packed problem
Список pgsql-bugs

Hi Andrew,

I forgot to show the final version of pg_bvarchar.

/* SQL function: bvarchar(varchar) returns bytea */

PG_FUNCTION_INFO_V1(pg_bvarchar);
Datum pg_bvarchar(PG_FUNCTION_ARGS) {
  VarChar *arg = PG_GETARG_VARCHAR_PP(0);
  unsigned len;
  bytea *res;

  len = VARSIZE_ANY_EXHDR(arg);
  res = (text *) palloc(len);
  SET_VARSIZE(res, len + VARHDRSZ);
  memcpy(VARDATA(res), VARDATA_ANY(arg), len);
  PG_RETURN_BYTEA_P(res);
}


On 9.3.19. 11:08, gmail Vladimir Koković wrote:

Hi Andrew,

You are absolutely right and "select ", OID from ispp_wmpl where (bvarchar (key))> = (bvarchar ('W' :: varchar)) and (bvarchar (key)) <= (bvarchar ~~~~~~~~ ':: varchar)) order by key" has passed!

However, pg log file now has hundreds of warning message:
2019-03-09 10:53:29 CET ispp-pionir-test :: 1 (53858) 14721 0 01000 WARNING: problem in allocation set ExprContext: detected write past chunk end block 0x55ccb0b36468, chunk 0x55ccb0b36490
2019-03-09 10:53:29 CET ispp-pionir-test :: 1 (53858) 14721 0 01000 WARNING: problem in allocation set ExprContext: detected write past chunk end in block 0x55ccb0b36468, chunk 0x55ccb0b36490
2019-03-09 10:53:29 CET ispp-pionir-test :: 1 (53858) 14721 0 01000 WARNING: problem in allocation set ExprContext: detected write past chunk end in block 0x55ccb0b36468, chunk 0x55ccb0b36490 
...
Andrew, I have to thank you for this help because without this, my 'select' would never have passed.


Vladimir Koković, DP senior(69)
Belgrade, Mar. 9 2019

On 9.3.19. 10:48, Andrew Gierth wrote:

"gmail" == gmail Vladimir Koković <vladimir.kokovic@gmail.com> writes:
 gmail> Hi Andrew.gmail> I changed VARSIZE to VARSIZE_ANY_EXHDR and VARDATA ingmail> VARDATA_ANY as you said, but there is still a problem I can notgmail> understand !

Your message formatting was all messed up, but I can see that you are
still subtracting VARHDRSZ - don't do that: VARSIZE_ANY_EXHDR already
has the header size subtracted (hence "EXHDR"), it returns only the data
size. (The header size is variable, 1 or 4 bytes, so it wouldn't make
sense to include it.)

В списке pgsql-bugs по дате отправления:

Предыдущее
От: gmail Vladimir Koković
Дата:
Сообщение: Re: BUG #15653: pg_detoast_datum_packed problem
Следующее
От: gmail Vladimir Koković
Дата:
Сообщение: Re: BUG #15653: pg_detoast_datum_packed problem