Re: Proposed patch for error locations

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Proposed patch for error locations
Date: 2006-03-13 15:44:24
Message-ID: 7550.1142264664@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces pgsql-patches

Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> My only comment is: Wouldn't it be clearer in the long run to create a
> ParseNode base structure which is used in place of NodeTag for
> parsenodes, and put the "int location" in there.

Only if we really wanted *every* parse node to carry a location, which
I think is overkill. If we took it far enough we'd be needing location
decoration on List nodes too, and that is definitely not happening.

There's a tradeoff here between completeness of information and
performance. In some quick tests with pgbench I don't detect any
noticeable performance loss with the patch as proposed, but it'd be
very easy to cross the threshold to where it does cost performance,
if we get too excited about decorating parse nodes with more than a
minimal amount of overhead.

> Finally, is the count in characters or bytes (w.r.t. multibyte
> encodings)?

Bytes; see the comments. Converting to a character count only happens
if an actual error message has to be emitted. (This is uglier than I
would like, but I don't see any sufficiently-cheap way to get the lexer
to count multibyte characters correctly.)

regards, tom lane

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Volkan YAZICI 2006-03-13 15:55:31 Re: Receiving SIGPIPE for PQfinish(<broken-connection>)
Previous Message Alvaro Herrera 2006-03-13 15:32:09 Re: Proposed p.tch for error locations

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-03-13 15:57:07 Re: Proposed p.tch for error locations
Previous Message Alvaro Herrera 2006-03-13 15:32:09 Re: Proposed p.tch for error locations