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 8eb82b80-0d5f-7fe0-eac6-2320a3364f2e@eisentraut.org
Whole thread Raw
In response to 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 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().



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Outdated description of PG_CACHE_LINE_SIZE
Next
From: Julien Rouhaud
Date:
Subject: Re: Outdated description of PG_CACHE_LINE_SIZE