Re: try_relation_open and relation_open behave different.

From: Xing GUO <higuoxing(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: try_relation_open and relation_open behave different.
Date: 2021-10-18 07:38:13
Message-ID: CACpMh+D5iSQ+-mHJrXCJDZ+KZ3zBTeTZsgP4eRnZJA7Kk=LEGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 18, 2021 at 2:45 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Mon, Oct 18, 2021 at 01:56:07PM +0800, Xing GUO wrote:
> > My question is, is it a deliberate design that makes try_relation_open
> and
> > relation_open different? Shall we mention it in the comment of
> > try_relation_open OR adding the checker to relation_open?
>
> I am not sure what you mean here, both functions are include comments
> to explain their differences, so..
>

The comments in try_relation_open says:

```
/* ----------------
* try_relation_open - open any relation by relation OID
*
* Same as relation_open, except return NULL instead of failing
* if the relation does not exist.
* ----------------
*/
```

However, I can open an "uncommitted" relation using relation_open() and
cannot open it using try_relation_open().
Since Postgres doesn't write the "uncommitted" relation descriptor to
SysCache and try_relation_open() checks if the
relation exists in SysCache while relation_open() doesn't check it.

> --
> Michael
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-10-18 07:46:40 Re: BUG #17220: ALTER INDEX ALTER COLUMN SET (..) with an optionless opclass makes index and table unusable
Previous Message Amit Langote 2021-10-18 07:28:57 Re: Partition Check not updated when insert into a partition