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