Re: Throw error and ErrorContext question.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Gevik Babakhani" <pgdev(at)xs4all(dot)nl>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Throw error and ErrorContext question.
Date: 2007-11-08 01:31:34
Message-ID: 13055.1194485494@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Gevik Babakhani" <pgdev(at)xs4all(dot)nl> writes:
> I have considered a noError boolean too.

> but please considered the following:

> step 1: call qualifiedNameToVar(noError = true), which generates an error
> but gets suppressed by noError parameter.

> step 2: process function parameter name for
> funct1.param1, check "funct1" == <the name of the current function>,
> which "funct1" is unknown/ambiguous (the name of the current function was
> "func" for example).

> In the case above I thought I somehow re-throw the error that
> was originally generated at step 1.

Yeah, you'd throw the same error number and message as that routine
would have thrown, but matching that is not rocket science ;-).
I don't see any value in trying to have only one instance of the
ereport() call instead of two --- it's going to cost you *more*
lines of code and *more* intellectual complexity to try to trap
and re-throw the error than it will cost to just have two identical
ereport() calls.

Although quite frankly I don't see any need to be touching
qualifiedNameToVar at all. It's already defined to return NULL if it
doesn't find the name anyplace in the query, which seems to me to be
what you want anyway. The only non-internal error it might raise is
"ambiguous name" which is fine. That's an error condition, and the
possibility that there is a function variable visible at an outer name
scoping level doesn't make it not an error.

The place where you need to be refactoring is probably in or around
the transformWholeRowRef/ParseFuncOrColumn sequence.

One thing that we need to think about is what is the priority of
function-variable matching compared to implicit RTE creation. I'm
inclined to think we should allow function variables to go first...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-11-08 02:01:57 Re: fulltext parser strange behave
Previous Message Tom Lane 2007-11-08 01:11:37 Re: fulltext parser strange behave