Convert an int column to bigint with the 4 bytes of padding available If there's 4 bytes of padding that would fit the bigint perfectly, is it possible to efficiently convert it on-the-spot by taking advantage of that gap?

CREATE TABLE a (
    b SERIAL PRIMARY KEY,
    c TIMESTAMP WITH TIME ZONE NOT NULL,
    d TIMESTAMP WITH TIME ZONE NOT NULL,
);


I understand that indexes and foreign keys would still be affected, but just wondering about the table itself.
Are you asking if the table heap size would be affected, then no the 4 extra bytes of padding would be used for the bigint, and the table would be unchanged since the following data type (timestamptz) uses 8 bytes and would be placed on the following "column" as it were. This should also hold true for indexes, I believe anything up to 8 bytes will occupy the same space per row.

Tested using postgresql 10:

insert into a (c,d) select generate_series(now(), now()+interval '100000 days', interval '1 day'), now();
INSERT 0 100001

select pg_relation_size('a');
 pg_relation_size 
------------------
          5218304
(1 row)

select pg_total_relation_size('a');
 pg_total_relation_size 
------------------------
                7479296
(1 row)


alter table a alter column b type bigint;

select pg_relation_size('a');
 pg_relation_size 
------------------
          5218304
(1 row)

select pg_total_relation_size('a');
 pg_total_relation_size 
------------------------
                7479296
(1 row)


Were you to change your id column to smallint, (smallint primary key on table can only have a maximum of 65535 rows, deleting rows would lead to a different issue...) the data size would likewise still not be affected since the following timestamp column could still not be squeezed next to it.