diff --git a/.github/workflows/broken_links_checker.yml b/.github/workflows/broken_links_checker.yml index 22c6b80..55d839d 100644 --- a/.github/workflows/broken_links_checker.yml +++ b/.github/workflows/broken_links_checker.yml @@ -22,7 +22,7 @@ jobs: } steps: - id: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: { persist-credentials: false } diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 958e269..6a207dc 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -33,12 +33,12 @@ jobs: fail-fast: false matrix: exasol_db_version: [ - 2025.2.1, - 2025.1.10 + 2026.1.0, + 2025.1.13 ] env: { - DEFAULT_EXASOL_DB_VERSION: 2025.2.1 + DEFAULT_EXASOL_DB_VERSION: 2026.1.0 } steps: - name: Free Disk Space @@ -49,7 +49,7 @@ jobs: sudo rm -rf /usr/share/dotnet - name: Checkout the repository id: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: { fetch-depth: 0, persist-credentials: false @@ -61,11 +61,11 @@ jobs: distribution: temurin java-version: |- 11 - 17 + 21 cache: maven - name: Cache SonarCloud packages id: cache-sonar - uses: actions/cache@v5 + uses: actions/cache@v6 with: { path: ~/.sonar/cache, key: '${{ runner.os }}-sonar', @@ -107,7 +107,35 @@ jobs: } - name: Verify Release Artifacts id: verify-release-artifacts - run: "print_message() {\n local -r message=$1\n echo \"$message\"\n echo \"$message\" >> \"$GITHUB_STEP_SUMMARY\"\n}\n\nprint_message \"### Release Artifacts\"\n\nIFS=$'\\n' artifacts_array=($ARTIFACTS)\nmissing_files=()\nfor file in \"${artifacts_array[@]}\";\ndo \n echo \"Checking if file $file exists...\"\n if ! [[ -f \"$file\" ]]; then\n print_message \"* ⚠️ \\`$file\\` does not exist ⚠️\"\n echo \"Content of directory $(dirname \"$file\"):\"\n ls \"$(dirname \"$file\")\"\n missing_files+=(\"$file\")\n else\n print_message \"* \\`$file\\` ✅\" \n fi\ndone\nprint_message \"\"\nnumber_of_missing_files=${#missing_files[@]}\nif [[ $number_of_missing_files -gt 0 ]]; then\n print_message \"⚠️ $number_of_missing_files release artifact(s) missing ⚠️\"\n exit 1\nfi\n" + run: | + print_message() { + local -r message=$1 + echo "$message" + echo "$message" >> "$GITHUB_STEP_SUMMARY" + } + + print_message "### Release Artifacts" + + IFS=$'\n' artifacts_array=($ARTIFACTS) + missing_files=() + for file in "${artifacts_array[@]}"; + do + echo "Checking if file $file exists..." + if ! [[ -f "$file" ]]; then + print_message "* ⚠️ \`$file\` does not exist ⚠️" + echo "Content of directory $(dirname "$file"):" + ls "$(dirname "$file")" + missing_files+=("$file") + else + print_message "* \`$file\` ✅" + fi + done + print_message "" + number_of_missing_files=${#missing_files[@]} + if [[ $number_of_missing_files -gt 0 ]]; then + print_message "⚠️ $number_of_missing_files release artifact(s) missing ⚠️" + exit 1 + fi env: { ARTIFACTS: '${{ steps.build-pk-verify.outputs.release-artifacts }}' } @@ -152,7 +180,7 @@ jobs: steps: - name: Checkout the repository id: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: { fetch-depth: 0, persist-credentials: false @@ -187,7 +215,7 @@ jobs: steps: - name: Checkout the repository id: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: { persist-credentials: false } @@ -198,7 +226,7 @@ jobs: distribution: temurin java-version: |- 11 - 17 + 21 cache: maven server-id: ossindex server-username: OSSINDEX_USERNAME @@ -232,13 +260,13 @@ jobs: steps: - name: Checkout the repository id: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: { persist-credentials: false } - name: Lint GitHub actions with Zizmore id: lint-github-actions - uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e + uses: zizmorcore/zizmor-action@192e21d79ab29983730a13d1382995c2307fbcaa with: { advanced-security: false } @@ -264,7 +292,7 @@ jobs: steps: - name: Checkout the repository id: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: { fetch-depth: 0, persist-credentials: false @@ -276,7 +304,7 @@ jobs: distribution: temurin java-version: |- 11 - 17 + 21 cache: maven - name: Check if release is needed id: check-release diff --git a/.github/workflows/dependencies_check.yml b/.github/workflows/dependencies_check.yml index c7220ca..fa5164f 100644 --- a/.github/workflows/dependencies_check.yml +++ b/.github/workflows/dependencies_check.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout id: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: { persist-credentials: false } @@ -38,7 +38,7 @@ jobs: distribution: temurin java-version: |- 11 - 17 + 21 cache: maven server-id: ossindex server-username: OSSINDEX_USERNAME @@ -56,7 +56,7 @@ jobs: } - name: Create GitHub Issues id: create-security-issues - uses: exasol/python-toolbox/.github/actions/security-issues@7.0.0 + uses: exasol/python-toolbox/.github/actions/security-issues@10.1.0 with: { format: maven, command: cat ossindex-report.json, diff --git a/.github/workflows/dependencies_update.yml b/.github/workflows/dependencies_update.yml index 73478fe..1986eae 100644 --- a/.github/workflows/dependencies_update.yml +++ b/.github/workflows/dependencies_update.yml @@ -34,7 +34,7 @@ jobs: cancel-in-progress: false } steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 id: checkout with: { fetch-depth: 0, @@ -47,7 +47,7 @@ jobs: distribution: temurin java-version: |- 11 - 17 + 21 cache: maven - name: Print issues id: debug-print-issues diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5baca97..1b177b5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -75,7 +75,7 @@ jobs: steps: - name: Checkout the repository id: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: { fetch-depth: 0, persist-credentials: true @@ -88,7 +88,7 @@ jobs: distribution: temurin java-version: |- 11 - 17 + 21 server-id: maven-central-portal server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD @@ -102,7 +102,7 @@ jobs: distribution: temurin java-version: |- 11 - 17 + 21 cache: maven - name: Fail if not running on main or release branch id: check-main-or-release-branch diff --git a/.github/zizmor.yml b/.github/zizmor.yml index 4b5fd60..a8508a1 100644 --- a/.github/zizmor.yml +++ b/.github/zizmor.yml @@ -20,6 +20,7 @@ rules: obfuscation: ignore: # Generated workflows use boolean conditions like ${{ false }} + # Note: We cannot exclude this using inline comments because GitHubWorkflowIO does not preserve comments in the workflow YAML files. - ci-build.yml - release.yml - project-keeper-verify.yml diff --git a/.project-keeper.yml b/.project-keeper.yml index 0d094f5..caf9e70 100644 --- a/.project-keeper.yml +++ b/.project-keeper.yml @@ -11,8 +11,8 @@ build: runnerOs: ubuntu-24.04 freeDiskSpace: false exasolDbVersions: - - "2025.2.1" - - "2025.1.10" + - "2026.1.0" # Latest version + - "2025.1.13" # Latest LTS version workflows: - name: ci-build.yml stepCustomizations: diff --git a/.vscode/settings.json b/.vscode/settings.json index 37e25d5..ea1e5ff 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,7 +11,7 @@ "java.test.config": { "vmArgs": [ "-Djava.util.logging.config.file=src/test/resources/logging.properties", - "-Dcom.exasol.dockerdb.image=2025.2.1" + "-Dcom.exasol.dockerdb.image=2026.1.0" ], "env": { "TESTCONTAINERS_RYUK_DISABLED": "true" diff --git a/dependencies.md b/dependencies.md index 8c73040..f7aa1cb 100644 --- a/dependencies.md +++ b/dependencies.md @@ -31,33 +31,33 @@ ## Plugin Dependencies -| Dependency | License | -| ------------------------------------------------------- | ------------------------------------------- | -| [SonarQube Scanner for Maven][32] | [GNU LGPL 3][33] | -| [Apache Maven Toolchains Plugin][34] | [Apache-2.0][35] | -| [Apache Maven Compiler Plugin][36] | [Apache-2.0][35] | -| [Apache Maven Enforcer Plugin][37] | [Apache-2.0][35] | -| [Maven Flatten Plugin][38] | [Apache Software License][35] | -| [org.sonatype.ossindex.maven:ossindex-maven-plugin][39] | [ASL2][23] | -| [Maven Surefire Plugin][40] | [Apache-2.0][35] | -| [Versions Maven Plugin][41] | [Apache License, Version 2.0][35] | -| [duplicate-finder-maven-plugin Maven Mojo][42] | [Apache License 2.0][43] | -| [Apache Maven Artifact Plugin][44] | [Apache-2.0][35] | -| [Apache Maven Assembly Plugin][45] | [Apache-2.0][35] | -| [Apache Maven JAR Plugin][46] | [Apache-2.0][35] | -| [Artifact reference checker and unifier][47] | [MIT License][48] | -| [Project Keeper Maven plugin][49] | [The MIT License][50] | -| [Apache Maven Dependency Plugin][51] | [Apache-2.0][35] | -| [Exec Maven Plugin][52] | [Apache License 2][35] | -| [Maven Failsafe Plugin][53] | [Apache-2.0][35] | -| [JaCoCo :: Maven Plugin][54] | [EPL-2.0][31] | -| [Quality Summarizer Maven Plugin][55] | [MIT License][56] | -| [error-code-crawler-maven-plugin][57] | [MIT License][58] | -| [Git Commit Id Maven Plugin][59] | [GNU Lesser General Public License 3.0][60] | -| [Apache Maven Clean Plugin][61] | [Apache-2.0][35] | -| [Apache Maven Resources Plugin][62] | [Apache-2.0][35] | -| [Apache Maven Install Plugin][63] | [Apache-2.0][35] | -| [Apache Maven Site Plugin][64] | [Apache-2.0][35] | +| Dependency | License | +| ------------------------------------------------------- | ---------------------------------------------- | +| [SonarQube Scanner for Maven][32] | [GNU LGPL 3][33] | +| [Apache Maven Toolchains Plugin][34] | [Apache-2.0][35] | +| [Apache Maven Compiler Plugin][36] | [Apache-2.0][35] | +| [Apache Maven Enforcer Plugin][37] | [Apache-2.0][35] | +| [Maven Flatten Plugin][38] | [Apache Software License][35] | +| [org.sonatype.ossindex.maven:ossindex-maven-plugin][39] | [ASL2][23] | +| [Maven Surefire Plugin][40] | [Apache-2.0][35] | +| [Versions Maven Plugin][41] | [Apache License, Version 2.0][35] | +| [duplicate-finder-maven-plugin Maven Mojo][42] | [Apache License 2.0][43] | +| [Apache Maven Artifact Plugin][44] | [Apache-2.0][35] | +| [Apache Maven Assembly Plugin][45] | [Apache-2.0][35] | +| [Apache Maven JAR Plugin][46] | [Apache-2.0][35] | +| [Artifact reference checker and unifier][47] | [MIT License][48] | +| [spdx-maven-plugin Maven Plugin][49] | [The Apache Software License, Version 2.0][23] | +| [Project Keeper Maven plugin][50] | [The MIT License][51] | +| [Apache Maven Dependency Plugin][52] | [Apache-2.0][35] | +| [Exec Maven Plugin][53] | [Apache License 2][35] | +| [Maven Failsafe Plugin][54] | [Apache-2.0][35] | +| [JaCoCo :: Maven Plugin][55] | [EPL-2.0][31] | +| [error-code-crawler-maven-plugin][56] | [MIT License][57] | +| [Git Commit Id Maven Plugin][58] | [GNU Lesser General Public License 3.0][59] | +| [Apache Maven Clean Plugin][60] | [Apache-2.0][35] | +| [Apache Maven Resources Plugin][61] | [Apache-2.0][35] | +| [Apache Maven Install Plugin][62] | [Apache-2.0][35] | +| [Apache Maven Site Plugin][63] | [Apache-2.0][35] | [0]: https://github.com/exasol/virtual-schema-common-jdbc/ [1]: https://github.com/exasol/virtual-schema-common-jdbc/blob/main/LICENSE @@ -108,19 +108,18 @@ [46]: https://maven.apache.org/plugins/maven-jar-plugin/ [47]: https://github.com/exasol/artifact-reference-checker-maven-plugin/ [48]: https://github.com/exasol/artifact-reference-checker-maven-plugin/blob/main/LICENSE -[49]: https://github.com/exasol/project-keeper/ -[50]: https://github.com/exasol/project-keeper/blob/main/LICENSE -[51]: https://maven.apache.org/plugins/maven-dependency-plugin/ -[52]: https://www.mojohaus.org/exec-maven-plugin -[53]: https://maven.apache.org/surefire/maven-failsafe-plugin/ -[54]: https://www.jacoco.org/jacoco/trunk/doc/maven.html -[55]: https://github.com/exasol/quality-summarizer-maven-plugin/ -[56]: https://github.com/exasol/quality-summarizer-maven-plugin/blob/main/LICENSE -[57]: https://github.com/exasol/error-code-crawler-maven-plugin/ -[58]: https://github.com/exasol/error-code-crawler-maven-plugin/blob/main/LICENSE -[59]: https://github.com/git-commit-id/git-commit-id-maven-plugin -[60]: http://www.gnu.org/licenses/lgpl-3.0.txt -[61]: https://maven.apache.org/plugins/maven-clean-plugin/ -[62]: https://maven.apache.org/plugins/maven-resources-plugin/ -[63]: https://maven.apache.org/plugins/maven-install-plugin/ -[64]: https://maven.apache.org/plugins/maven-site-plugin/ +[49]: https://github.com/spdx/spdx-maven-plugin +[50]: https://github.com/exasol/project-keeper/ +[51]: https://github.com/exasol/project-keeper/blob/main/LICENSE +[52]: https://maven.apache.org/plugins/maven-dependency-plugin/ +[53]: https://www.mojohaus.org/exec-maven-plugin +[54]: https://maven.apache.org/surefire/maven-failsafe-plugin/ +[55]: https://www.jacoco.org/jacoco/trunk/doc/maven.html +[56]: https://github.com/exasol/error-code-crawler-maven-plugin/ +[57]: https://github.com/exasol/error-code-crawler-maven-plugin/blob/main/LICENSE +[58]: https://github.com/git-commit-id/git-commit-id-maven-plugin +[59]: http://www.gnu.org/licenses/lgpl-3.0.txt +[60]: https://maven.apache.org/plugins/maven-clean-plugin/ +[61]: https://maven.apache.org/plugins/maven-resources-plugin/ +[62]: https://maven.apache.org/plugins/maven-install-plugin/ +[63]: https://maven.apache.org/plugins/maven-site-plugin/ diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md index 9c1edc1..66c575f 100644 --- a/doc/changes/changelog.md +++ b/doc/changes/changelog.md @@ -1,5 +1,6 @@ # Changes +* [4.0.1](changes_4.0.1.md) * [4.0.0](changes_4.0.0.md) * [3.1.1](changes_3.1.1.md) * [3.1.0](changes_3.1.0.md) diff --git a/doc/changes/changes_4.0.1.md b/doc/changes/changes_4.0.1.md new file mode 100644 index 0000000..8b2a877 --- /dev/null +++ b/doc/changes/changes_4.0.1.md @@ -0,0 +1,62 @@ +# Virtual Schema for PostgreSQL 4.0.1, released 2026-07-30 + +Code name: Fixed vulnerabilities CVE-2026-9563, CVE-2026-54291 + +## Summary + +This release adds support for pushdown of scalar function `DAYOFWEEK`. The pushdown only returns correct results when the parameter `NLS_FIRST_DAY_OF_WEEK` is set to `7` (= Sunday). + +The release also fixes the following 2 vulnerabilities: + +### CVE-2026-9563 (CWE-400) in dependency `org.eclipse.parsson:parsson:jar:1.1.7:test` +In Eclipse Parsson published Maven Central artifacts before version 1.1.8, the JSON parser did not enforce a default maximum on the number of characters consumed while parsing a single JSON document. Applications that parse attacker- controlled JSON can be forced to consume excessive CPU and memory by processing very large documents, including large arrays, objects, strings, numbers, whitespace, or nested structures, resulting in a denial of service. Eclipse Parsson 1.1.8 introduces a configurable maximum parsing limit with a default limit of 15 million parser-consumed characters. +#### References +* https://guide.sonatype.com/vulnerability/CVE-2026-9563?component-type=maven&component-name=org.eclipse.parsson%2Fparsson&utm_source=ossindex-client&utm_medium=integration&utm_content=1.8.1 +* http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2026-9563 +* https://github.com/eclipse-ee4j/parsson/pull/169 +* https://gitlab.eclipse.org/security/vulnerability-reports/-/work_items/444 + +### CVE-2026-54291 (CWE-636) in dependency `org.postgresql:postgresql:jar:42.7.11:compile` +pgjdbc is an open source postgresql JDBC Driver. In releases 42.7.4 through 42.7.11, channelBinding=require connections can be silently downgraded from SCRAM-SHA-256-PLUS with channel binding to plain SCRAM-SHA-256 without it, losing the man-in-the-middle protection the setting is meant to guarantee. An attacker who can intercept the TLS connection can trigger the downgrade with a certificate whose signature algorithm has no tls-server-end-point channel-binding hash, because the bundled com.ongres.scram:scram-client returns an empty byte array instead of failing and pgJDBC ScramAuthenticator checks only that the server advertised a PLUS mechanism, without rejecting the empty binding or checking that the negotiated mechanism uses channel binding. This issue is fixed in version 42.7.12. +#### References +* https://guide.sonatype.com/vulnerability/CVE-2026-54291?component-type=maven&component-name=org.postgresql%2Fpostgresql&utm_source=ossindex-client&utm_medium=integration&utm_content=1.8.1 +* http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2026-54291 +* https://github.com/ongres/scram/security/advisories/GHSA-p9jg-fcr6-3mhf +* https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-j92g-9f8w-j867 + +## Security + +* #93: Fixed vulnerability CVE-2026-9563 in dependency `org.eclipse.parsson:parsson:jar:1.1.7:test` +* #94: Fixed vulnerability CVE-2026-54291 in dependency `org.postgresql:postgresql:jar:42.7.11:compile` + +## Dependency Updates + +### Compile Dependency Updates + +* Updated `com.exasol:virtual-schema-common-jdbc:14.0.2` to `14.0.4` +* Updated `org.postgresql:postgresql:42.7.11` to `42.7.13` + +### Test Dependency Updates + +* Updated `com.exasol:autogenerated-resource-verifier-java:0.1.2` to `0.1.3` +* Updated `com.exasol:exasol-testcontainers:7.3.0` to `8.0.1` +* Updated `com.exasol:hamcrest-resultset-matcher:1.7.2` to `1.7.3` +* Updated `com.exasol:test-db-builder-java:4.0.0` to `4.0.2` +* Updated `com.exasol:udf-debugging-java:0.6.18` to `0.6.20` +* Updated `com.exasol:virtual-schema-common-jdbc:14.0.2` to `14.0.4` +* Updated `org.jacoco:org.jacoco.agent:0.8.14` to `0.8.15` + +### Plugin Dependency Updates + +* Updated `com.exasol:artifact-reference-checker-maven-plugin:0.4.4` to `1.0.1` +* Updated `com.exasol:error-code-crawler-maven-plugin:2.0.7` to `2.1.0` +* Updated `com.exasol:project-keeper-maven-plugin:5.6.2` to `5.7.4` +* Removed `com.exasol:quality-summarizer-maven-plugin:0.2.1` +* Updated `org.apache.maven.plugins:maven-dependency-plugin:3.10.0` to `3.11.0` +* Updated `org.apache.maven.plugins:maven-enforcer-plugin:3.6.2` to `3.6.3` +* Updated `org.apache.maven.plugins:maven-failsafe-plugin:3.5.5` to `3.5.6` +* Updated `org.apache.maven.plugins:maven-site-plugin:3.21.0` to `3.22.0` +* Updated `org.apache.maven.plugins:maven-surefire-plugin:3.5.5` to `3.5.6` +* Updated `org.jacoco:jacoco-maven-plugin:0.8.14` to `0.8.15` +* Updated `org.sonarsource.scanner.maven:sonar-maven-plugin:5.5.0.6356` to `5.7.0.6970` +* Added `org.spdx:spdx-maven-plugin:1.0.4` diff --git a/doc/user_guide/postgresql_user_guide.md b/doc/user_guide/postgresql_user_guide.md index 688f6dc..1d06993 100644 --- a/doc/user_guide/postgresql_user_guide.md +++ b/doc/user_guide/postgresql_user_guide.md @@ -53,7 +53,7 @@ The SQL statement below creates the adapter script, defines the Java class that --/ CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS %scriptclass com.exasol.adapter.RequestDispatcher; - %jar /buckets///virtual-schema-dist-14.0.2-postgresql-4.0.0.jar; + %jar /buckets///virtual-schema-dist-14.0.4-postgresql-4.0.1.jar; %jar /buckets///postgresql-.jar; / ``` @@ -231,3 +231,7 @@ A best practice for this mode is: **always quote identifiers** (in the PostgreSQ | TSVECTOR | ✓ | VARCHAR(2000000) | | | UUID | ✓ | VARCHAR(2000000) | | | XML | ✓ | VARCHAR(2000000) | | + +## Scalar Functions + +The `DAYOFWEEK` scalar function is pushed down to PostgreSQL. This pushdown only returns correct results when the parameter `NLS_FIRST_DAY_OF_WEEK` is set to `7` (= Sunday). diff --git a/pk_generated_parent.pom b/pk_generated_parent.pom index b927b33..e44670d 100644 --- a/pk_generated_parent.pom +++ b/pk_generated_parent.pom @@ -3,7 +3,7 @@ 4.0.0 com.exasol postgresql-virtual-schema-generated-parent - 4.0.0 + 4.0.1 pom UTF-8 @@ -39,7 +39,7 @@ org.jacoco org.jacoco.agent - 0.8.14 + 0.8.15 test runtime @@ -65,7 +65,7 @@ org.apache.maven.plugins maven-site-plugin - 3.21.0 + 3.22.0 org.codehaus.mojo @@ -83,7 +83,7 @@ org.sonarsource.scanner.maven sonar-maven-plugin - 5.5.0.6356 + 5.7.0.6970 org.apache.maven.plugins @@ -109,8 +109,7 @@ maven-compiler-plugin 3.15.0 - ${java.version} - ${java.version} + ${java.version} true -Xlint:all @@ -121,7 +120,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.6.2 + 3.6.3 enforce-maven @@ -188,7 +187,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.5.5 + 3.5.6 ${argLine} @@ -310,7 +309,7 @@ com.exasol artifact-reference-checker-maven-plugin - 0.4.4 + 1.0.1 verify @@ -320,10 +319,39 @@ + + + org.spdx + spdx-maven-plugin + 1.0.4 + + + build-spdx + package + + createSPDX + + + + + build + + true + true + true + true + false + false + Copyright (c) Exasol + false + JSON-LD + ${project.build.directory}/site/${project.groupId}.${project.artifactId}-${project.version}.spdx3.json + + org.apache.maven.plugins maven-dependency-plugin - 3.10.0 + 3.11.0 copy-jacoco @@ -343,7 +371,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.5.5 + 3.5.6 ${argLine} @@ -369,7 +397,7 @@ org.jacoco jacoco-maven-plugin - 0.8.14 + 0.8.15 prepare-agent @@ -413,23 +441,10 @@ - - com.exasol - quality-summarizer-maven-plugin - 0.2.1 - - - summarize-metrics - - summarize - - - - com.exasol error-code-crawler-maven-plugin - 2.0.7 + 2.1.0 verify diff --git a/pom.xml b/pom.xml index a09ba5a..ad49f37 100644 --- a/pom.xml +++ b/pom.xml @@ -2,12 +2,12 @@ 4.0.0 postgresql-virtual-schema - 4.0.0 + 4.0.1 Virtual Schema for PostgreSQL Virtual Schema for connecting PostgreSQL as data source to Exasol https://github.com/exasol/postgresql-virtual-schema/ - 14.0.2 + 14.0.4 2.0.5 @@ -24,7 +24,7 @@ org.postgresql postgresql - 42.7.11 + 42.7.13 @@ -57,7 +57,7 @@ com.exasol exasol-testcontainers - 7.3.0 + 8.0.1 test @@ -75,19 +75,19 @@ com.exasol test-db-builder-java - 4.0.0 + 4.0.2 test com.exasol hamcrest-resultset-matcher - 1.7.2 + 1.7.3 test com.exasol udf-debugging-java - 0.6.18 + 0.6.20 test @@ -99,7 +99,7 @@ com.exasol autogenerated-resource-verifier-java - 0.1.2 + 0.1.3 test @@ -128,7 +128,7 @@ com.exasol project-keeper-maven-plugin - 5.6.2 + 5.7.4 @@ -192,7 +192,7 @@ postgresql-virtual-schema-generated-parent com.exasol - 4.0.0 + 4.0.1 pk_generated_parent.pom diff --git a/src/main/java/com/exasol/adapter/dialects/postgresql/PostgresSQLSqlGenerationVisitor.java b/src/main/java/com/exasol/adapter/dialects/postgresql/PostgresSQLSqlGenerationVisitor.java index f58a138..4e040b3 100644 --- a/src/main/java/com/exasol/adapter/dialects/postgresql/PostgresSQLSqlGenerationVisitor.java +++ b/src/main/java/com/exasol/adapter/dialects/postgresql/PostgresSQLSqlGenerationVisitor.java @@ -62,33 +62,35 @@ public String visit(final SqlFunctionScalar function) throws AdapterException { } final ScalarFunction scalarFunction = function.getFunction(); switch (scalarFunction) { - case ADD_DAYS: - return getAddDateTime(argumentsSql, "days"); - case ADD_HOURS: - return getAddDateTime(argumentsSql, "hours"); - case ADD_MINUTES: - return getAddDateTime(argumentsSql, "mins"); - case ADD_SECONDS: - return getAddDateTime(argumentsSql, "secs"); - case ADD_WEEKS: - return getAddDateTime(argumentsSql, "weeks"); - case ADD_YEARS: - return getAddDateTime(argumentsSql, "years"); - case ADD_MONTHS: - return getAddDateTime(argumentsSql, "months"); - case SECOND: - case MINUTE: - case DAY: - case WEEK: - case MONTH: - case YEAR: - return getDateTime(argumentsSql, scalarFunction); - case POSIX_TIME: - return getPosixTime(argumentsSql); - case FLOAT_DIV: - return getCastToDoublePrecisionAndDivide(argumentsSql); - default: - return super.visit(function); + case ADD_DAYS: + return getAddDateTime(argumentsSql, "days"); + case ADD_HOURS: + return getAddDateTime(argumentsSql, "hours"); + case ADD_MINUTES: + return getAddDateTime(argumentsSql, "mins"); + case ADD_SECONDS: + return getAddDateTime(argumentsSql, "secs"); + case ADD_WEEKS: + return getAddDateTime(argumentsSql, "weeks"); + case ADD_YEARS: + return getAddDateTime(argumentsSql, "years"); + case ADD_MONTHS: + return getAddDateTime(argumentsSql, "months"); + case SECOND: + case MINUTE: + case DAY: + case WEEK: + case MONTH: + case YEAR: + return getDateTime(argumentsSql, scalarFunction); + case POSIX_TIME: + return getPosixTime(argumentsSql); + case FLOAT_DIV: + return getCastToDoublePrecisionAndDivide(argumentsSql); + case DAYOFWEEK: + return pushdownDayOfWeek(argumentsSql); + default: + return super.visit(function); } } @@ -97,6 +99,12 @@ private String getCastToDoublePrecisionAndDivide(final List sqlArguments + " AS DOUBLE PRECISION))"; } + private String pushdownDayOfWeek(final List argumentsSql) { + // Postgres: 0 = Sunday, ... 6 = Saturday + // Exasol: 1 = Sunday, ... 7 = Saturday when NLS_FIRST_DAY_OF_WEEK = 7 (Sunday) + return "(EXTRACT(DOW FROM " + argumentsSql.get(0) + ") + 1)"; + } + private String getAddDateTime(final List argumentsSql, final String unit) { final StringBuilder builder = new StringBuilder(); builder.append(argumentsSql.get(0)); @@ -121,45 +129,45 @@ private String getDateTime(final List argumentsSql, final ScalarFunction return builder.toString(); } - private static void appendDatePart(ScalarFunction scalarFunction, StringBuilder builder) { + private static void appendDatePart(final ScalarFunction scalarFunction, final StringBuilder builder) { switch (scalarFunction) { - case SECOND: - builder.append("'SECOND'"); - break; - case MINUTE: - builder.append("'MINUTE'"); - break; - case DAY: - builder.append("'DAY'"); - break; - case WEEK: - builder.append("'WEEK'"); - break; - case MONTH: - builder.append("'MONTH'"); - break; - case YEAR: - builder.append("'YEAR'"); - break; - default: - break; + case SECOND: + builder.append("'SECOND'"); + break; + case MINUTE: + builder.append("'MINUTE'"); + break; + case DAY: + builder.append("'DAY'"); + break; + case WEEK: + builder.append("'WEEK'"); + break; + case MONTH: + builder.append("'MONTH'"); + break; + case YEAR: + builder.append("'YEAR'"); + break; + default: + break; } } - private static void appendDecimalSize(ScalarFunction scalarFunction, StringBuilder builder) { + private static void appendDecimalSize(final ScalarFunction scalarFunction, final StringBuilder builder) { switch (scalarFunction) { - case SECOND: - case MINUTE: - case DAY: - case WEEK: - case MONTH: - builder.append("2"); - break; - case YEAR: - builder.append("4"); - break; - default: - break; + case SECOND: + case MINUTE: + case DAY: + case WEEK: + case MONTH: + builder.append("2"); + break; + case YEAR: + builder.append("4"); + break; + default: + break; } } @@ -203,4 +211,4 @@ public String visit(final SqlFunctionAggregateGroupConcat function) throws Adapt builder.append(") "); return builder.toString(); } -} \ No newline at end of file +} diff --git a/src/test/java/com/exasol/adapter/dialects/postgresql/PostgresSQLSqlGenerationVisitorTest.java b/src/test/java/com/exasol/adapter/dialects/postgresql/PostgresSQLSqlGenerationVisitorTest.java index e297456..645da34 100644 --- a/src/test/java/com/exasol/adapter/dialects/postgresql/PostgresSQLSqlGenerationVisitorTest.java +++ b/src/test/java/com/exasol/adapter/dialects/postgresql/PostgresSQLSqlGenerationVisitorTest.java @@ -1,6 +1,7 @@ package com.exasol.adapter.dialects.postgresql; import static com.exasol.adapter.dialects.VisitorAssertions.assertSqlNodeConvertedToOne; +import static com.exasol.adapter.sql.ScalarFunction.DAYOFWEEK; import static com.exasol.adapter.sql.ScalarFunction.POSIX_TIME; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; @@ -86,6 +87,12 @@ void testVisitSqlFunctionScalarPosixTime() throws AdapterException { assertThat(this.visitor.visit(sqlFunctionScalar), equalTo("EXTRACT(EPOCH FROM \"test_column\")")); } + @Test + void testVisitSqlFunctionScalarDayOfWeek() throws AdapterException { + final SqlFunctionScalar sqlFunctionScalar = createSqlFunctionScalarForDateTest(DAYOFWEEK, 0); + assertThat(this.visitor.visit(sqlFunctionScalar), equalTo("(EXTRACT(DOW FROM \"test_column\") + 1)")); + } + @Test void testVisitSqlSelectListAnyValue() throws AdapterException { final SqlSelectList sqlSelectList = SqlSelectList.createAnyValueSelectList(); diff --git a/src/test/java/com/exasol/adapter/dialects/postgresql/PostgresVirtualSchemaIntegrationTestSetup.java b/src/test/java/com/exasol/adapter/dialects/postgresql/PostgresVirtualSchemaIntegrationTestSetup.java index 0f1a2c7..d7cda57 100644 --- a/src/test/java/com/exasol/adapter/dialects/postgresql/PostgresVirtualSchemaIntegrationTestSetup.java +++ b/src/test/java/com/exasol/adapter/dialects/postgresql/PostgresVirtualSchemaIntegrationTestSetup.java @@ -28,11 +28,11 @@ * This class contains the common integration test setup for all PostgreSQL virtual schemas. */ public class PostgresVirtualSchemaIntegrationTestSetup implements Closeable { - private static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-14.0.2-postgresql-4.0.0.jar"; + private static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-14.0.4-postgresql-4.0.1.jar"; private static final Path PATH_TO_VIRTUAL_SCHEMAS_JAR = Path.of("target", VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION); private static final String SCHEMA_EXASOL = "SCHEMA_EXASOL"; private static final String ADAPTER_SCRIPT_EXASOL = "ADAPTER_SCRIPT_EXASOL"; - private static final String EXASOL_DOCKER_IMAGE_REFERENCE = "2025.2.1"; + private static final String EXASOL_DOCKER_IMAGE_REFERENCE = "2026.1.0"; // https://hub.docker.com/_/postgres private static final String POSTGRES_CONTAINER_NAME = "postgres:18.4";