Re: patch: improve "user mapping not found" error message

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Ian Lawrence Barwick <barwick(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: patch: improve "user mapping not found" error message
Date: 2023-07-03 09:22:48
Message-ID: 8eb82b80-0d5f-7fe0-eac6-2320a3364f2e@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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().

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2023-07-03 09:24:23 Re: Outdated description of PG_CACHE_LINE_SIZE
Previous Message Heikki Linnakangas 2023-07-03 09:01:55 Re: Outdated description of PG_CACHE_LINE_SIZE