Re: Patch: show relation and tuple infos of a lock to acquire

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Patch: show relation and tuple infos of a lock to acquire
Дата
Msg-id 20140313144523.GF4744@eldon.alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: Patch: show relation and tuple infos of a lock to acquire  (Christian Kruse <christian@2ndquadrant.com>)
Список pgsql-hackers
In this loop,

> +            for (i = 0; i < desc->natts; i++)
> +            {
> +                char       *val;
> +                int            vallen;
> +

> +                vallen = strlen(val);
> +                if (vallen <= maxfieldlen)
> +                    appendStringInfoString(&buf, val);
> +                else
> +                {
> +                    vallen = pg_mbcliplen(val, vallen, maxfieldlen);
> +                    appendBinaryStringInfo(&buf, val, vallen);
> +                    appendStringInfoString(&buf, "...");
> +                }
> +            }

you're checking that each individual field doesn't go over maxfieldlen
chars (30), but if the fields are numerous, this could end up being very
long anyway.  I think you need to limit total length as well, and as
soon as buf.len exceeds some number of chars, exit the loop.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [PATCH] Store Extension Options
Следующее
От: Greg Stark
Дата:
Сообщение: Re: jsonb and nested hstore