Re: BUG #17877: Referencing a system column in a foreign key leads to incorrect memory access - Mailing list pgsql-hackers

From Tom Lane
Subject Re: BUG #17877: Referencing a system column in a foreign key leads to incorrect memory access
Date
Msg-id 581090.1680290713@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #17877: Referencing a system column in a foreign key leads to incorrect memory access  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: BUG #17877: Referencing a system column in a foreign key leads to incorrect memory access  (Ranier Vilela <ranier.vf@gmail.com>)
List pgsql-hackers
Ranier Vilela <ranier.vf@gmail.com> writes:
> I think that commit f0d65c0
> <https://github.com/postgres/postgres/commit/f0d65c0eaf05d6acd3ae05cde4a31465eb3992b2>
> has an oversight.
> Attnum == 0, is system column too, right?

No, it's not valid in pg_attribute rows.

> All other places at tablecmds.c, has this test:
> if (attnum <= 0)
>     ereport(ERROR,

I was actually copying this code in indexcmds.c:

        if (attno < 0)
            ereport(ERROR,
                    (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                     errmsg("index creation on system columns is not supported")));

There's really no reason to prefer one over the other in this context.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: running logical replication as the subscription owner
Next
From: Dmitry Dolgov
Date:
Subject: Re: Schema variables - new implementation for Postgres 15