Re: patch: improve "user mapping not found" error message - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: patch: improve "user mapping not found" error message
Date
Msg-id 84e1470b-5c5d-46f8-a623-b6a2350ca2b3@eisentraut.org
Whole thread Raw
In response to Re: patch: improve "user mapping not found" error message  (Ian Lawrence Barwick <barwick@gmail.com>)
Responses Re: patch: improve "user mapping not found" error message
List pgsql-hackers
On 20.11.23 02:25, Ian Lawrence Barwick wrote:
> 2023年7月3日(月) 18:22 Peter Eisentraut <peter@eisentraut.org>:
>>
>> On 23.06.23 09:45, Ian Lawrence Barwick wrote:
>>>        if (!HeapTupleIsValid(tp))
>>> +     {
>>> +             ForeignServer *server = GetForeignServer(serverid);
>>> +
>>>                ereport(ERROR,
>>>                                (errcode(ERRCODE_UNDEFINED_OBJECT),
>>> -                              errmsg("user mapping not found for \"%s\"",
>>> -                                             MappingUserName(userid))));
>>> +                              errmsg("user mapping not found for user \"%s\", server \"%s\"",
>>> +                                             MappingUserName(userid),
>>> +                                             server->servername)));
>>> +     }
>>
>> What if the foreign server does not exist either?  Then this would show
>> a "cache lookup failed" error message, which I think we should avoid.
>>
>> There is existing logic for handling this in
>> get_object_address_usermapping().
> 
> Apologies, missed this response somewhere. Does the attached fix that?

Hmm, now that I look at this again, under what circumstances would the 
server not be found?  Maybe the first patch was right and it should give 
a "scary" error in that case, instead of just omitting it.

In any case, this patch appears to be missing an update in the 
postgres_fdw test output.




pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: [PATCH] Add CHECK_FOR_INTERRUPTS in scram_SaltedPassword loop.
Next
From: Maxim Orlov
Date:
Subject: Re: How to stop autovacuum silently