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

INSERT INTO fails (hangs) when values are derived from SELECT, in combination with a FOREIGN KEY constraint #2845

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2011-07-22 12:24:01 +0200
From: Evert Rol <<evert.astro>>
To: SQL devs <>
Version: 11.3.7 (Apr2011-SP2) [obsolete]
CC: evert.astro, @njnes

Last updated: 2011-09-16 15:04:32 +0200

Comment 15980

Date: 2011-07-22 12:24:01 +0200
From: Evert Rol <<evert.astro>>

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30
Build Identifier:

monetdb (mclient) hangs if an insert using a select statement is executed. This only happens when there is a foreign key constraint.
Use case example:

CREATE TABLE table1 ( tablename VARCHAR(50) NOT NULL, PRIMARY KEY (tablename) ); CREATE TABLE table2 ( table1_name VARCHAR(50) NOT NULL, FOREIGN KEY (table1_name) REFERENCES table1 (tablename) ); insert into table1 (tablename) values ('A'); insert into table2 (table1_name) values ('A'); -- Things go wrong here: insert into table2 (table1_name) select 'A';

The process hangs indefinitely, and if the database is not stopped (ie, the mclient may be escaped by ctrl-C, but the server still continues to run), the process will eat up all CPU time and, in my case, overheat and shut down my macbook :-(.
There are no useful entries in the log file related to this.

On Linux (Ubuntu 11.04, 64 bit, through a VM on OS X), this bug shows up as well, but then the mclient quits with a '!Connection terminated' in the logfile. I have not checked if the background server process hangs indefinitely.

The bug does not show up in an older version (specifically, the Oct2010 release).

Reproducible: Always

Steps to Reproduce:

  1. Create a database
  2. Use the client to access the database (via SQL)
  3. Execute the following SQL:
    CREATE TABLE table1 (
    tablename VARCHAR(50) NOT NULL,
    PRIMARY KEY (tablename)
    );
    CREATE TABLE table2 (
    table1_name VARCHAR(50) NOT NULL,
    FOREIGN KEY (table1_name) REFERENCES table1 (tablename)
    );
    insert into table1 (tablename) values ('A');
    insert into table2 (table1_name) values ('A');
    -- Things go wrong here:
    insert into table2 (table1_name) select 'A';

Actual Results:

On OS X: hangs indefinitely

On Linux: mclient abruptly terminates, without explanation.

Expected Results:

Would have expected to insert a value into the table.

$> mserver5 --version
MonetDB 5 server v11.3.3 "Apr2011-SP1" (64-bit, 64-bit oids)
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2011 MonetDB B.V., all rights reserved
Visit http://monetdb.cwi.nl/ for further information
Found 8.0GiB available memory, 8 available cpu cores
Libraries:
libpcre: 8.12 2011-01-15 (compiled with 8.12)
openssl: OpenSSL 0.9.8l 5 Nov 2009 (compiled with OpenSSL 1.0.0d 8 Feb 2011)
libxml2: 2.7.3 (compiled with 2.7.3)
Compiled by: (x86_64-apple-darwin10.8.0)
Compilation: gcc -g -O2
Linking : /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld

Comment 15981

Date: 2011-07-22 13:06:10 +0200
From: @sjoerdmullender

When assertions are enabled, one goes off:
sql/server/rel_exp.c:279: exp_column: Assertion `cname' failed.

Comment 15982

Date: 2011-07-22 15:38:32 +0200
From: Evert Rol <<evert.astro>>

I mentioned Oct2010 as a working version; Mar2011 (v11.1.1) does not have the bug either, and works fine.
But Apr2011SP2 (v11.3.5) does have the bug as well.

Comment 15984

Date: 2011-07-25 16:52:14 +0200
From: @njnes

Changeset d06c28c1ad30 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=d06c28c1ad30

Changeset description:

add test for bug #2845

Comment 15985

Date: 2011-07-25 16:53:24 +0200
From: @njnes

Changeset 343d84ba2ede 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=343d84ba2ede

Changeset description:

fixed bug #2845. Name (label) unnamed atom expression

Comment 16047

Date: 2011-07-29 11:03:53 +0200
From: @sjoerdmullender

Apr2011-SP2 has been released.

Comment 16236

Date: 2011-09-16 15:04:32 +0200
From: @sjoerdmullender

The Aug2011 version has been released.

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

Successfully merging a pull request may close this issue.

None yet
1 participant