Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add column as primary key creates mixed_objects unhandled deployment #51

Open
jfinzel opened this issue Dec 19, 2019 · 0 comments
Open

Comments

@jfinzel
Copy link
Collaborator

jfinzel commented Dec 19, 2019

ALTER TABLE foo ADD COLUMN bar_id SERIAL generates an unhandled deployment.

Here is why: here is what it shows:

 id |       set_name        |  pid  |   txid    | classid |  objid   | objsubid |   command_tag   | object_type | schema_name |                      object_identity                      | in_extension | set_config_id
----+-----------------------+-------+-----------+---------+----------+----------+-----------------+-------------+-------------+-----------------------------------------------------------+--------------+---------------
  1 | insert_update_special | 10795 | 960613833 |    1259 | 87397177 |        0 | CREATE SEQUENCE | sequence    | foo   | foo.bla_payments_bla_payment_id_seq | f            |             1
  2 | insert_update_special | 10795 | 960613833 |    1259 | 26311794 |        0 | ALTER TABLE     | table       | foo   | foo.bla_payments                            | f            |             1
  3 | insert_update_special | 10795 | 960613833 |    1259 | 87397177 |        0 | ALTER SEQUENCE  | sequence    | foo   | foo.bla_payments_bla_payment_id_seq | f            |             1
(3 rows)

EDIT: This perhaps cannot be supported with replication, because the serial value generated on the subscriber would be different.

There is only 2 ways I see to handle this:

  1. User has to do this type of DDL in stages - add column, backfill it, then create and add the sequence with no DML involved, then swap the constraints
  2. Remove the table from replication and re-add it after this operation, if such a brute force approach is acceptable.

The resolution to this may need to be for documentation only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant