Re: pg_get_constraintdef failing with cache lookup error

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Postgres-Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: pg_get_constraintdef failing with cache lookup error
Date: 2015-04-28 01:35:26
Message-ID: CAB7nPqRCWCCicwUpNt79FP_J2royv54B9z=1zXvhCUQe3BCg9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Apr 28, 2015 at 3:15 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Mon, Apr 27, 2015 at 11:16 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
>>> pg_get_constraintdef() fails rather easily:
>>> =# select pg_get_constraintdef(1);
>>> ERROR: cache lookup failed for constraint 1
>>
>> It's expected that the caller will supply a valid pg_constraint OID.
>> I don't think it's necessary to go out of our way to throw a friendlier
>> error message if the OID isn't found.
>
> It's clearly at least a bug in the comment to complain that it can't
> happen if in fact it can. But I would argue that we should never hit
> an elog just because of bad user input.

Fine for me to just remove the comment, constraintdef is the only *def
function that has such one.
--
Michael

Attachment Content-Type Size
20150428_constraint_def_fix_comment.patch application/x-patch 521 bytes

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message georgi-georgiev-pgsql 2015-04-28 01:56:47 BUG #13182: pgadmin3 not showing in application list
Previous Message Thomas Munro 2015-04-28 00:19:36 Re: BUG #12990: Missing pg_multixact/members files (appears to have wrapped, then truncated)