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

Liquibase: Implement fix for handling primary keys with DESC columns #33

Closed
rafiss opened this issue Jul 21, 2020 · 1 comment
Closed
Assignees

Comments

@rafiss
Copy link

rafiss commented Jul 21, 2020

See the Slack thread for more info: https://cockroachlabs.slack.com/archives/CUG42HAN9/p1590500097054500

Dataical has added a cockroachdb-support branch that has a CockroachDatabase class.

When using Liquibase to make a table definition like this in CockroachDB, it errors out.

CREATE TABLE "order" (
  o_id INT8 NOT NULL,
  o_d_id INT8 NOT NULL,
  o_w_id INT8 NOT NULL,
  o_c_id INT8 NULL,
  o_entry_d TIMESTAMP NULL,
  o_carrier_id INT8 NULL,
  o_ol_cnt INT8 NULL,
  o_all_local INT8 NULL,
  CONSTRAINT "primary" PRIMARY KEY (o_w_id ASC, o_d_id ASC, o_id DESC),
  UNIQUE INDEX order_idx (o_w_id ASC, o_d_id ASC, o_c_id ASC, o_id DESC) STORING (o_entry_d, o_carrier_id),
  FAMILY "primary" (o_id, o_d_id, o_w_id, o_c_id, o_entry_d, o_carrier_id, o_ol_cnt, o_all_local)
)

You see how it is creating a PK with o_id DESC. This is cockroach-specific syntax not available in regular postgresql. In postgresql, you can only create primary keys with asc columns. Our generic postgresql support doesn’t have support for WITH INDEX primary keys like we do for other databases, I’m not sure if that is a good fit for this fix or not, though.

@rafiss
Copy link
Author

rafiss commented Aug 18, 2020

will be fixed by liquibase/liquibase#1319

@rafiss rafiss closed this as completed Oct 21, 2020
@rafiss rafiss reopened this Oct 21, 2020
@rafiss rafiss closed this as completed Oct 27, 2020
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

2 participants