Re: Syntax error reporting (was Re: [PATCHES] syntax error position "CREATE FUNCTION" bug fix)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Syntax error reporting (was Re: [PATCHES] syntax error position "CREATE FUNCTION" bug fix)
Date: 2004-03-22 15:12:01
Message-ID: 29795.1079968321@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> writes:
>>> More over, I have other ideas for CONTEXT, which should really be a stack.
>> It already is a stack.

> Ok, I agree that there is a "push", but I'm still looking fot the "pop".

> Maybe I missed something, but it seemed to me that strings are appended
> on to the other, and there is no way back.

But the string list is not constructed until the error actually occurs.
You don't need a pop at that point --- the call stack is what it is.

I think you are imagining that outer-level context hooks should be able
to editorialize on what inner-level ones said (or perhaps vice versa?)
but I honestly cannot think of a valid use-case for that.

> What I would have looked for, is a stack on which functions could push
> and pop informations as they want, so that the stack would be always
> available for any error or warning or debug trace down the callgraph.

Look at the existing examples of adjusting the error_context_stack.
They already do all that, they just don't bother to compute the error
strings unless actually needed. I'm not willing to push very much cost
into the non-error path of control when there's no visible payoff.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthew T. O'Connor 2004-03-22 15:27:55 Re: pg_autovacuum next steps
Previous Message Bruce Momjian 2004-03-22 14:59:33 Re: Custom format for pg_dumpall

Browse pgsql-patches by date

  From Date Subject
Next Message Fabien COELHO 2004-03-22 16:35:29 Re: Syntax error reporting (was Re: [PATCHES] syntax error
Previous Message Tom Lane 2004-03-22 15:04:01 Re: pstrndup()