Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DBRepo
Manage
Activity
Members
Labels
Plan
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FAIR Data Austria DB Repository
DBRepo
Commits
835cecdf
Commit
835cecdf
authored
1 year ago
by
Martin Weise
Browse files
Options
Downloads
Patches
Plain Diff
Group by all primary keys for MariaDB 11 Galera
parent
1f8dd40b
No related branches found
No related tags found
3 merge requests
!231
CI: Remove build for log-service
,
!228
Better error message handling in the frontend
,
!223
Release of version 1.4.0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
dbrepo-metadata-service/repositories/src/main/java/at/tuwien/mapper/TableMapper.java
+7
-3
7 additions, 3 deletions
...ositories/src/main/java/at/tuwien/mapper/TableMapper.java
with
7 additions
and
3 deletions
dbrepo-metadata-service/repositories/src/main/java/at/tuwien/mapper/TableMapper.java
+
7
−
3
View file @
835cecdf
...
...
@@ -493,17 +493,21 @@ public interface TableMapper {
.
append
(
data
.
getInternalName
())
.
append
(
"` AS SELECT * FROM (SELECT "
);
final
int
[]
idx
=
new
int
[]{
0
};
final
StringBuilder
keys
=
new
StringBuilder
();
data
.
getColumns
()
.
stream
()
.
filter
(
c
->
Objects
.
nonNull
(
c
.
getIsPrimaryKey
()))
.
filter
(
TableColumn:
:
getIsPrimaryKey
)
.
forEach
(
c
->
statement
.
append
(
idx
[
0
]++
>
0
?
","
:
""
)
.
forEach
(
c
->
keys
.
append
(
idx
[
0
]++
>
0
?
","
:
""
)
.
append
(
"`"
)
.
append
(
c
.
getInternalName
())
.
append
(
"`"
));
statement
.
append
(
", ROW_START AS inserted_at, IF(ROW_END > NOW(), NULL, ROW_END) AS deleted_at, COUNT(*) as total FROM `"
)
statement
.
append
(
keys
)
.
append
(
", ROW_START AS inserted_at, IF(ROW_END > NOW(), NULL, ROW_END) AS deleted_at, COUNT(*) as total FROM `"
)
.
append
(
data
.
getInternalName
())
.
append
(
"` FOR SYSTEM_TIME ALL GROUP BY inserted_at, deleted_at ORDER BY deleted_at DESC LIMIT 50) AS v ORDER BY v.inserted_at, v.deleted_at ASC"
);
.
append
(
"` FOR SYSTEM_TIME ALL GROUP BY "
)
.
append
(
keys
)
.
append
(
", inserted_at, deleted_at ORDER BY deleted_at DESC LIMIT 50) AS v ORDER BY v.inserted_at, v.deleted_at ASC"
);
try
{
final
PreparedStatement
pstmt
=
connection
.
prepareStatement
(
statement
.
toString
());
log
.
trace
(
"prepared create sequence statement {}"
,
statement
);
...
...
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