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

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: patch: improve "user mapping not found" error message
Date: 2023-11-20 01:25:42
Message-ID: CAB8KJ=i=ZEL7hEaj374dTXOkZzQqJ0ndDrtT0zp_dT2h833-Fg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2023年7月3日(月) 18:22 Peter Eisentraut <peter(at)eisentraut(dot)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?

Regards

Ian Barwick

Attachment Content-Type Size
user-mapping-not-found-message-improvement.v2.patch text/x-patch 1.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2023-11-20 01:56:45 Re: Windows default locale vs initdb
Previous Message Michael Paquier 2023-11-20 01:15:49 Re: Add recovery to pg_control and remove backup_label