create_reference_table() error on two tables with PK identity columns and a foreign key constraint
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
I'm seeing a regression when running create_reference_table() on two tables with a relationship to each other. They both have an identity column as a primary key.
I'm seeing different behaviour on docker images `citusdata/citus:11.2` and `citusdata/citus:11.3` when running the queries below
```
CREATE TABLE organisation
(
id bigint GENERATED BY DEFAULT AS IDENTITY,
branding_id bigint
);
CREATE TABLE branding
(
id bigint GENERATED BY DEFAULT AS IDENTITY
);
ALTER TABLE ONLY public.organisation
ADD CONSTRAINT organisation_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.branding
ADD CONSTRAINT branding_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.organisation
ADD CONSTRAINT organisation_branding_id_fk FOREIGN KEY (branding_id) REFERENCES public.branding(id) DEFERRABLE INITIALLY DEFERRED;
SELECT create_reference_table('branding');
SELECT create_reference_table('organisation');
```
Running the above on docker image `citusdata/citus:11.2` runs with no errors.
On `citusdata/citus:11.3`, the last query `SELECT create_reference_table('organisation');` comes back with an error
`ERROR: cannot complete operation on a table with identity column`.
My expectation is that that this query is supposed to succeed. Can you help?
Contributor guide
Assessment
This issue has not been assessed yet.