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

ALTER TABLE <tbl_nm> ADD CONSTRAINT <tbl_uc1> UNIQUE (col1, col2, col3) causes Assertion failure and abort #3669

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working major SQL

Comments

@monetdb-team
Copy link

Date: 2015-02-05 18:57:27 +0100
From: Martin van Dinther <<martin.van.dinther>>
To: SQL devs <>
Version: -- development
CC: @njnes

Last updated: 2015-05-07 12:37:34 +0200

Comment 20637

Date: 2015-02-05 18:57:27 +0100
From: Martin van Dinther <<martin.van.dinther>>

User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0
Build Identifier:

mserver5: ../../dev/gdk/gdk_group.c:386: BATgroup_internal: Assertion `g == ((void *)0) || ((b)->S->count) == ((g)->S->count)' failed.
mserver5.sh: line 5: 13885 Aborted /export/scratch1/dinther/INSTALL/bin/mserver5 -d10 --set embedded_r=true --set mapi_port=41000

Reproducible: Always

Steps to Reproduce:

  1. Start mserver5 (MonetDB v11.20.0 )
  2. Start mclient
  3. execute SQL:
    create table tab (id int not null, nm varchar(30) not null, dt date, qnt dec(30,10), descr text);
    -- table created.
    insert into tab (id, nm) values (1, 'A');
    insert into tab (id, nm, dt, qnt, descr) values (2, 'B', '2015-01-29', 3.1415629, 'iasdfhiasdhagdsnfgankkkjfgjklfgjklsklsklsdfg');
    select * from tab;
    -- 2 rows.
    insert into tab (id, nm, dt, qnt, descr) select id, nm, dt, qnt, descr from tab;
    --- 2 rows inserted
    select * from tab;
    -- 4 rows.
    select count() as count_dupl_rows, id, nm, dt, qnt, descr from tab
    group by id, nm, dt, qnt, descr having count(
    ) > 1
    order by id, nm, dt, qnt, descr;
    -- 2 rows (id = 1 and 2) exists twice.
    alter table tab add constraint tab_uc6 unique (id, nm, dt, qnt, descr);

Actual Results:

bash-4.2$ mclient -p 41000
Welcome to mclient, the MonetDB/SQL interactive terminal (unreleased)
Database: MonetDB v11.20.0 (unreleased), 'demo'
Type \q to quit, ? for a list of available commands
auto commit mode: on
sql>create table tab (id int not null, nm varchar(30) not null, dt date, qnt dec(30,10), descr text);
operation successful (7.160ms)
sql>insert into tab (id, nm) values (1, 'A');
1 affected row (1.533ms)
sql>insert into tab (id, nm, dt, qnt, descr) values (2, 'B', '2015-01-29', 3.1415629, 'iasdfhiasdhagdsnfgankkkjfgjklfgjklsklsklsdfg');
1 affected row (1.218ms)
sql>
sql>select * from tab;
+------+------+------------+----------------------------------+----------------------------------------------+
| id | nm | dt | qnt | descr |
+======+======+============+==================================+==============================================+
| 1 | A | null | null | null |
| 2 | B | 2015-01-29 | 3.1415629000 | iasdfhiasdhagdsnfgankkkjfgjklfgjklsklsklsdfg |
+------+------+------------+----------------------------------+----------------------------------------------+
2 tuples (2.444ms)
sql>insert into tab (id, nm, dt, qnt, descr) select id, nm, dt, qnt, descr from tab;
2 affected rows (2.841ms)
sql>select * from tab;
+------+------+------------+----------------------------------+----------------------------------------------+
| id | nm | dt | qnt | descr |
+======+======+============+==================================+==============================================+
| 1 | A | null | null | null |
| 2 | B | 2015-01-29 | 3.1415629000 | iasdfhiasdhagdsnfgankkkjfgjklfgjklsklsklsdfg |
| 1 | A | null | null | null |
| 2 | B | 2015-01-29 | 3.1415629000 | iasdfhiasdhagdsnfgankkkjfgjklfgjklsklsklsdfg |
+------+------+------------+----------------------------------+----------------------------------------------+
4 tuples (3.144ms)
sql>select count() as count_dupl_rows, id, nm, dt, qnt, descr from tab
more>group by id, nm, dt, qnt, descr having count(
) > 1
more>order by id, nm, dt, qnt, descr;
+------+------+------+------------+----------------------------------+----------------------------------------+
| coun | id | nm | dt | qnt | descr |
: t_du : : : : : :
: pl_r : : : : : :
: ows : : : : : :
+======+======+======+============+==================================+========================================+
| 2 | 1 | A | null | null | null |
| 2 | 2 | B | 2015-01-29 | 3.1415629000 | iasdfhiasdhagdsnfgankkkjfgjklfgjklskls |
: : : : : : klsdfg :
+------+------+------+------------+----------------------------------+----------------------------------------+
2 tuples (9.792ms)
sql>alter table tab add constraint tab_uc6 unique (id, nm, dt, qnt, descr);
sql>select * from tab;
bash-4.2$

bash-4.2$ ./start_INSTALL_mserver5.sh
builtin opt gdk_dbpath = /export/scratch1/dinther/INSTALL/var/monetdb5/dbfarm/demo
builtin opt gdk_debug = 0
builtin opt gdk_vmtrim = no
builtin opt monet_prompt = >
builtin opt monet_daemon = no
builtin opt mapi_port = 50000
builtin opt mapi_open = false
builtin opt mapi_autosense = false
builtin opt sql_optimizer = default_pipe
builtin opt sql_debug = 0
cmdline opt embedded_r = true
cmdline opt mapi_port = 41000
cmdline opt gdk_debug = 10
MonetDB 5 server v11.20.0
This is an unreleased version
Serving database 'demo', using 8 threads
Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit integers dynamically linked
Found 15.590 GiB available main-memory.
Copyright (c) 1993-July 2008 CWI.
Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
Visit http://www.monetdb.org/ for further information
Listening for connection requests on mapi:monetdb://127.0.0.1:41000/
MonetDB/GIS module loaded
MonetDB/SQL module loaded
MonetDB/R module loaded

mserver5: ../../dev/gdk/gdk_group.c:386: BATgroup_internal: Assertion `g == ((void *)0) || ((b)->S->count) == ((g)->S->count)' failed.
./start_INSTALL_mserver5.sh: line 5: 13885 Aborted /export/scratch1/dinther/INSTALL/bin/mserver5 -d10 --set embedded_r=true --set mapi_port=41000
bash-4.2$

Expected Results:

no assertion failure

Comment 20641

Date: 2015-02-08 21:42:17 +0100
From: MonetDB Mercurial Repository <>

Changeset d122ab45f0ec made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=d122ab45f0ec

Changeset description:

fixed bug #3669, correct alignment when removing nulls in ukey checks
@monetdb-team monetdb-team added bug Something isn't working major SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major SQL
Projects
None yet
Development

No branches or pull requests

2 participants