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

PRIMARY KEY constraint is not persistent through server restarts #7263

Closed
nuno-faria opened this issue Mar 7, 2022 · 1 comment
Closed

PRIMARY KEY constraint is not persistent through server restarts #7263

nuno-faria opened this issue Mar 7, 2022 · 1 comment
Labels
bug
Milestone

Comments

@nuno-faria
Copy link
Contributor

@nuno-faria nuno-faria commented Mar 7, 2022

Describe the bug
The PRIMARY KEY constraint is ignored when the server restarts, allowing multiples rows with the same key.

To Reproduce

  • Create a table with primary key

    CREATE TABLE Test (k int PRIMARY KEY, v int);
    
    \d Test
      CREATE TABLE "sys"."test" (
          "k" INTEGER       NOT NULL,
          "v" INTEGER,
          CONSTRAINT "test_k_pkey" PRIMARY KEY ("k")
      );
  • Check that the PRIMARY KEY constraint is respected:

    INSERT INTO Test VALUES(1, 1);
      1 affected row
    
    INSERT INTO Test VALUES(1, 1);
      INSERT INTO: PRIMARY KEY constraint 'test.test_k_pkey' violated
  • Restart the server

  • Check that the PRIMARY KEY constraint is ignored:

    \d Test
      CREATE TABLE "sys"."test" (
          "k" INTEGER       NOT NULL,
          "v" INTEGER,
          CONSTRAINT "test_k_pkey" PRIMARY KEY ("k") -- still here
      );
    
    INSERT INTO Test VALUES(1, 1);
      1 affected row
    INSERT INTO Test VALUES(1, 1);
      1 affected row
    INSERT INTO Test VALUES(1, 1);
      1 affected row
    
    SELECT * FROM Test;
      +------+------+
      | k    | v    |
      +======+======+
      |    1 |    1 |
      |    1 |    1 |
      |    1 |    1 |
      |    1 |    1 |
      +------+------+

Software versions

  • MonetDB master branch (most recent commit)
  • Ubuntu 20.04 LTS
  • Self-installed and compiled
@yzchang
Copy link
Member

@yzchang yzchang commented Mar 7, 2022

I can reproduce this with Jan2022-SP1

@yzchang yzchang added the bug label Mar 7, 2022
@PedroTadim PedroTadim added this to the NEXTRELEASE milestone Mar 7, 2022
@sjoerdmullender sjoerdmullender removed this from the NEXTRELEASE milestone Apr 8, 2022
@sjoerdmullender sjoerdmullender added this to the Jan2022-SP2 milestone Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug
Projects
None yet
Development

No branches or pull requests

4 participants