X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9FF609DC819 for ; Mon, 13 Mar 2006 11:44:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73070-01 for ; Mon, 13 Mar 2006 11:44:26 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 53C4D9DCCD4 for ; Mon, 13 Mar 2006 11:44:19 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k2DFiO34007551; Mon, 13 Mar 2006 10:44:24 -0500 (EST) To: Martijn van Oosterhout cc: pgsql-patches@postgresql.org Subject: Re: Proposed patch for error locations In-reply-to: <20060313114331.GC6714@svana.org> References: <20060313114331.GC6714@svana.org> Comments: In-reply-to Martijn van Oosterhout message dated "Mon, 13 Mar 2006 12:43:31 +0100" Date: Mon, 13 Mar 2006 10:44:24 -0500 Message-ID: <7550.1142264664@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/179 X-Sequence-Number: 19183 Martijn van Oosterhout 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