Re: BUG #17877: Referencing a system column in a foreign key leads to incorrect memory access

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: BUG #17877: Referencing a system column in a foreign key leads to incorrect memory access
Date: 2023-03-31 19:25:13
Message-ID: 581090.1680290713@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ranier Vilela <ranier(dot)vf(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Dolgov 2023-03-31 19:29:46 Re: Schema variables - new implementation for Postgres 15
Previous Message Robert Haas 2023-03-31 19:17:06 Re: running logical replication as the subscription owner