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

Fixes neo4j/apoc#126: apoc.periodic.submit fails with schema operations (core) #208

Merged
merged 2 commits into from
Oct 18, 2022

Conversation

vga91
Copy link
Collaborator

@vga91 vga91 commented Oct 11, 2022

Fixes #126 (core part)

  1. Added QueryType validations in validateQuery() method, so as to fail if the procedure tries to execute schema operations

  2. Refactored apoc.periodic.submit code in order to be reused in extended.

  3. In Fixes neo4j/apoc#126: apoc.periodic.submit fails with schema operations (extended) neo4j-contrib/neo4j-apoc-procedures#3211, added apoc.periodic.submitSchema procedure, equivalent but with different validateQuery() and org.neo4j.procedure.Mode.SCHEMA


NOTE FOR REVIEWER:

  • We could also create a schema equivalent for the others periodic procedures (maybe in another issue/pr?)
  • Even the apoc.trigger.add has the validateQuery(), maybe can be changed in the same way? (also in this case, perhaps in another pr)

@Lojjs Lojjs self-assigned this Oct 17, 2022
Copy link
Contributor

@Lojjs Lojjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just see the comment about cherry-picking. Regarding 'NOTE FOR THE REVIEWER':

  • I would not create schema equivalents for the other ones (maybe not for this one either, as I think it is a good enough solution to throw an error rather than fail silently)
  • I think it could be worth to make the same fix for apoc.trigger.add, either in this or a separate PR.

@Test
public void testSubmitWithSchemaOperation() {
try {
testCall(db, "CALL apoc.periodic.submit('subSchema','CREATE INDEX periodicIdx FOR (n:Bar) ON (n.first_name, n.last_name)')",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you cherry-pick to 4.x, it would be good to also add a test for CALL db.createUniquePropertyConstraint (that has been removed in Neo4j 5.0) to make sure this fix the original reported issue.

@vga91 vga91 merged commit 3700669 into dev Oct 18, 2022
@vga91 vga91 deleted the issue_126 branch October 18, 2022 09:45
vga91 added a commit to vga91/neo4j-apoc-procedures that referenced this pull request Oct 18, 2022
…ns (neo4j/apoc#208)

* Fixes neo4j/apoc#126: apoc.periodic.submit fails with schema operations (core)
* removed unused import
vga91 added a commit to neo4j-contrib/neo4j-apoc-procedures that referenced this pull request Oct 25, 2022
…ns (neo4j/apoc#208) (#3234)

* Fixes neo4j/apoc#126: apoc.periodic.submit fails with schema operations (neo4j/apoc#208)

* Fixes neo4j/apoc#126: Improve validateQuery (neo4j/apoc#218)
vga91 added a commit to vga91/neo4j-apoc-procedures that referenced this pull request Oct 25, 2022
…ns (neo4j/apoc#208) (neo4j-contrib#3234)

* Fixes neo4j/apoc#126: apoc.periodic.submit fails with schema operations (neo4j/apoc#208)

* Fixes neo4j/apoc#126: Improve validateQuery (neo4j/apoc#218)
vga91 added a commit to neo4j-contrib/neo4j-apoc-procedures that referenced this pull request Oct 25, 2022
…ns (neo4j/apoc#208) (#3234) (#3246)

* Fixes neo4j/apoc#126: apoc.periodic.submit fails with schema operations (neo4j/apoc#208)
* Fixes neo4j/apoc#126: Improve validateQuery (neo4j/apoc#218)
* removed unused imports
* fixed full compilation error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

can not get apoc.periodic.submit() to run CALL db.createUniquePropertyConstraint()
2 participants