Re: Patch: show relation and tuple infos of a lock to acquire - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Patch: show relation and tuple infos of a lock to acquire
Date
Msg-id 20140313144523.GF4744@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: Patch: show relation and tuple infos of a lock to acquire  (Christian Kruse <christian@2ndquadrant.com>)
List 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 by date:

Previous
From: Andres Freund
Date:
Subject: Re: [PATCH] Store Extension Options
Next
From: Greg Stark
Date:
Subject: Re: jsonb and nested hstore