Customer received the following error while trying to revoke privileges on a relation after migrating to 7.x .
prod=# REVOKE ALL ON public.table1 from admin;
ERROR: cache lookup failed for attribute -5 of relation 66668 (aclchk.c:1765)
Greenplum 7.3
This is due to an `ALTER TABLE <ao_or_co_table> SET ACCESS METHOD heap` or `ALTER TABLE <ao_or_co_table> SET WITH (appendonly=false)` operation.
We don't create the missing system attributes exclusive to heap (namely xmin, cmin, xmax and cmax) when making this transition.
Checking pg_attribute for this relation we see the following, attribute number -2, -3, -4, and -5 as per the error is missing.
dssprod=# select attrelid,attname,attnum from pg_attribute where attrelid = public.table1'::regclass order by attnum;
attrelid | attname | attnum
----------+---------------+--------
68373 | gp_segment_id | -7
68373 | tableoid | -6
68373 | ctid | -1
68373 | chain_id | 1
68373 | pe_name | 2
68373 | job_name | 3
68373 | prcs_start_ts | 4
68373 | prcs_end_ts | 5
68373 | prcs_status | 6
(9 rows)
Checking the pg_attribute for other relations that were not altered we see the following
dssprod=# select attrelid,attname,attnum from pg_attribute where attrelid = 'public.table2'::regclass order by attnum;
attrelid | attname | attnum
-----------+---------------+--------
296887567 | gp_segment_id | -7
296887567 | tableoid | -6
296887567 | cmax | -5
296887567 | xmax | -4
296887567 | cmin | -3
296887567 | xmin | -2
296887567 | ctid | -1
296887567 | chain_id | 1
296887567 | pe_name | 2
296887567 | job_name | 3
296887567 | prcs_start_ts | 4
296887567 | prcs_end_ts | 5
296887567 | prcs_status | 6
As a workaround
create table as select * from broken_table
This fix will be included in a future Greenplum Code version as of November 2024