diff --git a/.github/composite-actions/check-babelfish-inconsistency/action.yml b/.github/composite-actions/check-babelfish-inconsistency/action.yml index e4c6215b4f..fc9ca08a01 100644 --- a/.github/composite-actions/check-babelfish-inconsistency/action.yml +++ b/.github/composite-actions/check-babelfish-inconsistency/action.yml @@ -12,7 +12,7 @@ runs: FROM pg_proc WHERE proname = 'check_for_inconsistent_metadata';" | grep -o 'exists\|not_exists') - echo "::set-output name=function_exists::$function_exists" + echo "function_exists=$function_exists" >> $GITHUB_OUTPUT echo "Check Babelfish metadata inconsistency function exists: $function_exists" # If the function exists, run the metadata inconsistency check diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 48f11a54a2..8d8c4f1eda 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -147,7 +147,7 @@ jobs: - name: Download CSV report from previous run if: (github.event_name == 'schedule') - uses: dawidd6/action-download-artifact@v2 + uses: dawidd6/action-download-artifact@v6 with: name: csv_${{github.ref_name}} path: contrib/ diff --git a/.github/workflows/pg_dump-restore-test.yml b/.github/workflows/pg_dump-restore-test.yml index be998791b0..cbb1e009f2 100644 --- a/.github/workflows/pg_dump-restore-test.yml +++ b/.github/workflows/pg_dump-restore-test.yml @@ -23,7 +23,7 @@ jobs: dump_format: itm[itm.length - 1]['dump-format'], \ type: itm[itm.length - 1]['type']})); \ console.log(JSON.stringify(p));") - echo "::set-output name=dump-restore-path-list::$DUMP_RESTORE_PATH_LIST" + echo "dump-restore-path-list=$DUMP_RESTORE_PATH_LIST" >> $GITHUB_OUTPUT run-dump-restore-test: needs: generate-dump-restore-tests @@ -45,24 +45,24 @@ jobs: id: read-base-and-final-version if: always() && steps.install-yq.outcome == 'success' run: > - echo "::set-output name=base-version::$( + echo "base-version=$( yq '."dump-restore-version"[${{ matrix.upgrade-path.id }}][0].version' ${{ github.workspace }}/.github/configuration/dump-restore-test-configuration.yml - )" && - echo "::set-output name=final-version::$( + )" >> $GITHUB_OUTPUT && + echo "final-version=$( yq '."dump-restore-version"[${{ matrix.upgrade-path.id }}][-1].version' ${{ github.workspace }}/.github/configuration/dump-restore-test-configuration.yml - )" + )" >> $GITHUB_OUTPUT - name: Find Engine and Extension Branches for Base Version ${{ steps.read-base-and-final-version.outputs.base-version }} id: find-branch if: always() && steps.read-base-and-final-version.outcome == 'success' run: > - echo "::set-output name=base-engine-branch::$( + echo "base-engine-branch=$( yq '."${{ steps.read-base-and-final-version.outputs.base-version }}".engine_branch' ${{ github.workspace }}/.github/template/version-branch-template.yml - )" && - echo "::set-output name=base-extension-branch::$( + )" >> $GITHUB_OUTPUT && + echo "base-extension-branch=$( yq '."${{ steps.read-base-and-final-version.outputs.base-version }}".extension_branch' ${{ github.workspace }}/.github/template/version-branch-template.yml - )" && - echo "::set-output name=base-dir::$(echo psql$(awk -F. '{print $1}' <<< ${{ steps.read-base-and-final-version.outputs.base-version }}))" + )" >> $GITHUB_OUTPUT && + echo "base-dir=$(echo psql$(awk -F. '{print $1}' <<< ${{ steps.read-base-and-final-version.outputs.base-version }}))" >> $GITHUB_OUTPUT - name: Setup Base Version ${{ steps.read-base-and-final-version.outputs.base-version }} and Run Preparation Tests id: setup-base-version diff --git a/.github/workflows/upgrade-test.yml b/.github/workflows/upgrade-test.yml index ceefda3d17..ea1f3fccaa 100644 --- a/.github/workflows/upgrade-test.yml +++ b/.github/workflows/upgrade-test.yml @@ -16,7 +16,7 @@ jobs: config="'$(yq -o=json ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml)'" config=$(echo $config | sed "s/\"/\\\\\"/g") UPGRADE_PATH_LIST=$(node -e "let k = JSON.parse($config); let p = k['upgrade-version'].map((itm, index) => ({ id: index, path: itm['upgrade-path'].map(i => i.version.toString().replace(/[.]/g, \"_\")), server_collation_name: itm['babelfishpg_tsql_server_collation_name'] ? itm['babelfishpg_tsql_server_collation_name'] : \"default\", title: itm['upgrade-path'].map(i => i.version.toString().replace(/[.]/g, \"_\")).join(\"-\") + (itm['babelfishpg_tsql_server_collation_name'] ? (\" with server-collation - \" + itm['babelfishpg_tsql_server_collation_name'] + \" \") : \"\"), last_version: itm['upgrade-path'][itm['upgrade-path'].length - 1].version.toString().replace(/[.]/g, \"_\") })); console.log(JSON.stringify(p));") - echo "::set-output name=upgrade-path-list::$UPGRADE_PATH_LIST" + echo "upgrade-path-list=$UPGRADE_PATH_LIST" >> $GITHUB_OUTPUT run-version-upgrade-test: needs: generate-version-upgrade-tests @@ -38,24 +38,24 @@ jobs: id: read-base-and-final-version if: always() && steps.install-yq.outcome == 'success' run: > - echo "::set-output name=base-version::$( + echo "base-version=$( yq '."upgrade-version"[${{ matrix.upgrade-path.id }}]."upgrade-path"[0].version' ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml - )" && - echo "::set-output name=final-version::$( + )" >> $GITHUB_OUTPUT && + echo "final-version=$( yq '."upgrade-version"[${{ matrix.upgrade-path.id }}]."upgrade-path"[-1].version' ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml - )" + )" >> $GITHUB_OUTPUT - name: Find Engine and Extension Branches for Base Version ${{ steps.read-base-and-final-version.outputs.base-version }} id: find-branch if: always() && steps.read-base-and-final-version.outcome == 'success' run: > - echo "::set-output name=base-engine-branch::$( + echo "base-engine-branch=$( yq '."${{ steps.read-base-and-final-version.outputs.base-version }}".engine_branch' ${{ github.workspace }}/.github/template/version-branch-template.yml - )" && - echo "::set-output name=base-extension-branch::$( + )" >> $GITHUB_OUTPUT && + echo "base-extension-branch=$( yq '."${{ steps.read-base-and-final-version.outputs.base-version }}".extension_branch' ${{ github.workspace }}/.github/template/version-branch-template.yml - )" && - echo "::set-output name=base-dir::$(echo psql$(awk -F. '{print $1}' <<< ${{ steps.read-base-and-final-version.outputs.base-version }}))" + )" >> $GITHUB_OUTPUT && + echo "base-dir=$(echo psql$(awk -F. '{print $1}' <<< ${{ steps.read-base-and-final-version.outputs.base-version }}))" >> $GITHUB_OUTPUT - name: Setup Base Version ${{ steps.read-base-and-final-version.outputs.base-version }} and Run Preparation Tests id: setup-base-version diff --git a/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql b/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql index 42b51e1d1f..816a431509 100644 --- a/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql +++ b/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql @@ -2190,6 +2190,9 @@ BEGIN ELSIF role = 'public' COLLATE sys.database_default THEN RETURN 1; + + ELSEIF role = login THEN + RETURN 0; ELSIF role COLLATE sys.database_default IN ('sysadmin', 'securityadmin', 'dbcreator') THEN has_role = (pg_has_role(login::TEXT, role::TEXT, 'MEMBER') diff --git a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.4.0--4.5.0.sql b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.4.0--4.5.0.sql index 6d29506e03..ef6ac9b44b 100644 --- a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.4.0--4.5.0.sql +++ b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.4.0--4.5.0.sql @@ -1736,6 +1736,9 @@ BEGIN ELSIF role = 'public' COLLATE sys.database_default THEN RETURN 1; + + ELSEIF role = login THEN + RETURN 0; ELSIF role COLLATE sys.database_default IN ('sysadmin', 'securityadmin', 'dbcreator') THEN has_role = (pg_has_role(login::TEXT, role::TEXT, 'MEMBER') diff --git a/test/JDBC/expected/dbcreator_role-vu-verify.out b/test/JDBC/expected/dbcreator_role-vu-verify.out index e8f0a98cd6..800402c13a 100644 --- a/test/JDBC/expected/dbcreator_role-vu-verify.out +++ b/test/JDBC/expected/dbcreator_role-vu-verify.out @@ -32,6 +32,31 @@ int ~~END~~ +select is_srvrolemember('dbcreator','dbcreator') +go +~~START~~ +int +0 +~~END~~ + + +select is_srvrolemember('sysadmin','sysadmin') +go +~~START~~ +int +0 +~~END~~ + + +-- should return NULL for invalid login +select is_srvrolemember('l1', 'l1') +go +~~START~~ +int + +~~END~~ + + alter login dbcreator_login1 with password='123' go diff --git a/test/JDBC/expected/securityadmin_role-vu-verify.out b/test/JDBC/expected/securityadmin_role-vu-verify.out index ccabd5967a..97c6c10cc1 100644 --- a/test/JDBC/expected/securityadmin_role-vu-verify.out +++ b/test/JDBC/expected/securityadmin_role-vu-verify.out @@ -15,6 +15,14 @@ int ~~END~~ +select is_srvrolemember('securityadmin','securityadmin') +go +~~START~~ +int +0 +~~END~~ + + alter login securityadmin_login1 with password='123' go diff --git a/test/JDBC/expected/single_db/dbcreator_role-vu-verify.out b/test/JDBC/expected/single_db/dbcreator_role-vu-verify.out index f845656db2..5e997fc9da 100644 --- a/test/JDBC/expected/single_db/dbcreator_role-vu-verify.out +++ b/test/JDBC/expected/single_db/dbcreator_role-vu-verify.out @@ -32,6 +32,31 @@ int ~~END~~ +select is_srvrolemember('dbcreator','dbcreator') +go +~~START~~ +int +0 +~~END~~ + + +select is_srvrolemember('sysadmin','sysadmin') +go +~~START~~ +int +0 +~~END~~ + + +-- should return NULL for invalid login +select is_srvrolemember('l1', 'l1') +go +~~START~~ +int + +~~END~~ + + alter login dbcreator_login1 with password='123' go diff --git a/test/JDBC/input/dbcreator_role-vu-verify.mix b/test/JDBC/input/dbcreator_role-vu-verify.mix index e5c8dafaa0..397cb44366 100644 --- a/test/JDBC/input/dbcreator_role-vu-verify.mix +++ b/test/JDBC/input/dbcreator_role-vu-verify.mix @@ -13,6 +13,16 @@ go select is_srvrolemember('dbcreator', 'securityadmin') go +select is_srvrolemember('dbcreator','dbcreator') +go + +select is_srvrolemember('sysadmin','sysadmin') +go + +-- should return NULL for invalid login +select is_srvrolemember('l1', 'l1') +go + alter login dbcreator_login1 with password='123' go diff --git a/test/JDBC/input/securityadmin_role-vu-verify.mix b/test/JDBC/input/securityadmin_role-vu-verify.mix index e764c9e726..60c56562b8 100644 --- a/test/JDBC/input/securityadmin_role-vu-verify.mix +++ b/test/JDBC/input/securityadmin_role-vu-verify.mix @@ -5,6 +5,9 @@ go select is_srvrolemember('securityadmin', 'sysadmin') go +select is_srvrolemember('securityadmin','securityadmin') +go + alter login securityadmin_login1 with password='123' go diff --git a/test/JDBC/pom.xml b/test/JDBC/pom.xml index 57599c87ee..16d931c4c7 100644 --- a/test/JDBC/pom.xml +++ b/test/JDBC/pom.xml @@ -22,7 +22,7 @@ commons-io commons-io - 2.7 + 2.14.0 org.apache.commons