Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-mysqlbackend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-mysqlbackend
Commits
2de195e8
Commit
2de195e8
authored
4 years ago
by
Quazgar
Committed by
Florian Spreckelsen
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
FIX: Deleting child of 3 generations works now.
For issue
#21
parent
b0d949b1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
procedures/deleteIsaCache.sql
+3
-2
3 additions, 2 deletions
procedures/deleteIsaCache.sql
tests/test_issues.sql
+64
-0
64 additions, 0 deletions
tests/test_issues.sql
with
68 additions
and
2 deletions
CHANGELOG.md
+
1
−
0
View file @
2de195e8
...
@@ -58,5 +58,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
...
@@ -58,5 +58,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
*
Fixed several bugs when an Entity inherits from itself (#18, caosdb-server #85).
*
Fixed several bugs when an Entity inherits from itself (#18, caosdb-server #85).
*
Bug in
`updateEntity.sql`
(when updating the primary name without a prior call
*
Bug in
`updateEntity.sql`
(when updating the primary name without a prior call
to
`deleteEntityProperties`
). Same thing for
`deleteEntity`
.
to
`deleteEntityProperties`
). Same thing for
`deleteEntity`
.
*
#21 Bug which prevented deletion of deeply inheriting entities, if versioning was enabled.
### Security ###
### Security ###
This diff is collapsed.
Click to expand it.
procedures/deleteIsaCache.sql
+
3
−
2
View file @
2de195e8
...
@@ -29,7 +29,8 @@ DELIMITER //
...
@@ -29,7 +29,8 @@ DELIMITER //
/* Delete "is a" relations from the given entity towards ancestors.
/* Delete "is a" relations from the given entity towards ancestors.
Note that relations towards descendants are not deleted (they probably should have been deleted before).
Note that relations towards descendants are not deleted (they probably should have been deleted
before).
After this procedure, there are no more entries in `isa_cache`, where the
After this procedure, there are no more entries in `isa_cache`, where the
parameter entity is a child or inside the rpath.
parameter entity is a child or inside the rpath.
...
@@ -54,7 +55,7 @@ BEGIN
...
@@ -54,7 +55,7 @@ BEGIN
SELECT
e
.
child
,
IVersion
AS
child_iversion
,
e
.
parent
SELECT
e
.
child
,
IVersion
AS
child_iversion
,
e
.
parent
FROM
isa_cache
AS
e
FROM
isa_cache
AS
e
WHERE
e
.
child
=
EntityID
WHERE
e
.
child
=
EntityID
AND
e
.
rpath
=
EntityID
;
AND
e
.
rpath
=
CAST
(
EntityID
AS
CHAR
)
;
END
IF
;
END
IF
;
DELETE
FROM
isa_cache
DELETE
FROM
isa_cache
...
...
This diff is collapsed.
Click to expand it.
tests/test_issues.sql
0 → 100644
+
64
−
0
View file @
2de195e8
/**
* ** header v3.0
* This file is a part of the CaosDB Project.
*
* Copyright (C) 2020 IndiScale GmbH <info@indiscale.com>
* Copyright (C) 2020 Daniel Hornung <d.hornung@indiscale.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* ** end header
*/
USE
_caosdb_schema_unit_tests
;
BEGIN
;
CALL
tap
.
no_plan
();
-- ########################################################################
-- TEST Issues from https://gitlab.com/caosdb/caosdb-mysqlbackend/-/issues
-- ########################################################################
-------------------------------------------------------------------------------
-- Issue 21 --
-- Deleting a child with 3 levels of ancestors. --
-------------------------------------------------------------------------------
-- Setup
SET
@
SRID
=
"SRID_issue_21"
;
INSERT
INTO
transactions
(
srid
,
seconds
,
nanos
,
username
,
realm
)
VALUES
(
@
SRID
,
1234
,
2345
,
"me"
,
"home"
);
CALL
entityACL
(
@
ACLID1
,
"{acl1}"
);
-- Insert entities and obtain IDs
CALL
insertEntity
(
"A"
,
"Desc A"
,
"RECORDTYPE"
,
"{acl1}"
);
CALL
insertEntity
(
"B"
,
"Desc B"
,
"RECORDTYPE"
,
"{acl1}"
);
CALL
insertEntity
(
"C"
,
"Desc C"
,
"RECORDTYPE"
,
"{acl1}"
);
CALL
insertEntity
(
"rec"
,
"Desc rec"
,
"RECORD"
,
"{acl1}"
);
SELECT
entity_id
INTO
@
ID_A
FROM
name_data
WHERE
value
=
"A"
;
SELECT
entity_id
INTO
@
ID_B
FROM
name_data
WHERE
value
=
"B"
;
SELECT
entity_id
INTO
@
ID_C
FROM
name_data
WHERE
value
=
"C"
;
SELECT
entity_id
INTO
@
ID_rec
FROM
name_data
WHERE
value
=
"rec"
;
-- Insert is-a relationships
CALL
insertIsA
(
@
ID_A
,
@
ID_B
);
CALL
insertIsA
(
@
ID_B
,
@
ID_C
);
CALL
insertIsA
(
@
ID_rec
,
@
ID_A
);
-- Try to delete last child
-- leads to failure in issue #21
CALL
deleteIsa
(
@
ID_rec
);
ROLLBACK
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment