diff --git a/.github/workflows/merge-build-push.yml b/.github/workflows/merge-build-push.yml index 9aab23ee..5b99b8f7 100644 --- a/.github/workflows/merge-build-push.yml +++ b/.github/workflows/merge-build-push.yml @@ -14,7 +14,15 @@ on: jobs: build-and-deploy: + name: Publish docs (${{ matrix.target }}) runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [html, en, cn] + concurrency: + group: docs-publish-${{ inputs.source_branch || github.ref_name }}-${{ matrix.target }} + cancel-in-progress: true permissions: contents: write pull-requests: write @@ -25,14 +33,17 @@ jobs: with: path: ivorysql_doc ref: ${{ inputs.source_branch || github.sha }} + persist-credentials: false - name: Checkout Doc Builder Repository (doc_builder) uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/ivory-doc-builder path: ivory-doc-builder + persist-credentials: false - name: Determine Latest Version from ivorysql_docs branches + if: matrix.target == 'html' id: latest_version_step shell: bash run: | @@ -55,13 +66,15 @@ jobs: - name: Install yq run: | - sudo apt-get update -y - sudo apt-get install -y jq - sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq - sudo chmod +x /usr/bin/yq - yq --version + mkdir -p "$RUNNER_TEMP/docs-tools" + curl --fail --silent --show-error --location \ + https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \ + --output "$RUNNER_TEMP/docs-tools/yq" + chmod +x "$RUNNER_TEMP/docs-tools/yq" + echo "$RUNNER_TEMP/docs-tools" >> "$GITHUB_PATH" - name: Modify Antora Playbooks + if: matrix.target == 'html' working-directory: ./ivory-doc-builder env: DETECTED_VERSION: '${{ steps.latest_version_step.outputs.version }}' @@ -101,22 +114,88 @@ jobs: fi done - - name: Pin PDF assembler to source branch + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.15' + + - name: Install Antora CLI + env: + TARGET: ${{ matrix.target }} + run: | + packages=(antora@3.1.7) + if [[ "$TARGET" == html ]]; then + packages+=(@antora/lunr-extension @node-rs/jieba) + else + packages+=(@antora/pdf-extension@1.0.0-beta.20) + fi + npm install --global "${packages[@]}" + + - name: Set up Ruby for PDF export + if: matrix.target != 'html' + timeout-minutes: 10 + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + + - name: Install Asciidoctor PDF + if: matrix.target != 'html' + timeout-minutes: 10 + run: | + gem install asciidoctor-pdf --version "~>2.3.19" + gem install rouge + + - name: Export PDF + id: pdf + if: matrix.target != 'html' + timeout-minutes: 60 working-directory: ./ivory-doc-builder + shell: bash env: - MERGED_BRANCH: ${{ inputs.source_branch || github.ref_name }} - COMPONENT_NAME: ivorysql-doc + PDF_LANGUAGE: ${{ matrix.target }} + SOURCE_BRANCH: ${{ inputs.source_branch || github.ref_name }} run: | - if [[ -z "${MERGED_BRANCH}" ]]; then - echo "::error::Merged branch name is empty, cannot update PDF component version." + descriptor="../ivorysql_doc/${PDF_LANGUAGE^^}/antora.yml" + playbook="antora-playbook-${PDF_LANGUAGE^^}.yml" + component="$(yq -er '.name' "$descriptor")" + version="$(yq -er '.version' "$descriptor")" + page="$(yq -r '.start_page // "index.adoc"' "$descriptor")" + + if [[ "$component" != ivorysql-doc || "$version" != "$SOURCE_BRANCH" ]]; then + echo "::error::Expected ivorysql-doc version $SOURCE_BRANCH, found $component version $version." exit 1 fi + if [[ "$page" != *:* ]]; then + page=":$page" + fi - TARGET_COMPONENT_VERSION="${MERGED_BRANCH}@${COMPONENT_NAME}" - echo "Setting antora-assembler.yml component_versions to ${TARGET_COMPONENT_VERSION}" - yq -i ".component_versions = \"${TARGET_COMPONENT_VERSION}\"" antora-assembler.yml - echo "Updated antora-assembler.yml:" - cat antora-assembler.yml + START_PAGE="$component:$page" UI_BUNDLE="./${PDF_LANGUAGE}templates.zip" yq -i ' + .content.sources[0].url = "../ivorysql_doc" | + .content.sources[0].branches = ["HEAD"] | + .runtime.fetch = false | + .site.start_page = strenv(START_PAGE) | + .ui.bundle.url = strenv(UI_BUNDLE) | + del(.urls.latest_version_segment, .urls.latest_version_segment_strategy) | + del(.antora.extensions[] | select(. == "@antora/lunr-extension" or .require == "@antora/lunr-extension")) + ' "$playbook" + + # Keep the dots small enough to fit the line height of every TOC level. + pdf_theme="$(yq -er '.asciidoc.attributes."pdf-theme"' antora-assembler.yml)" + yq -i '.toc."dot-leader"."font-size" = 10' "$pdf_theme" + COMPONENT_VERSION="$version@$component" BUILD_DIR="$RUNNER_TEMP/assembler" yq -i ' + .component_versions = strenv(COMPONENT_VERSION) | + .asciidoc.attributes."toc-max-pagenum-digits" = 4 | + .build.dir = strenv(BUILD_DIR) | + .build.command = "asciidoctor-pdf --failure-level ERROR" + ' antora-assembler.yml + time npx antora generate --stacktrace --to-dir "$RUNNER_TEMP/pdf-site" "$playbook" + pdf="$RUNNER_TEMP/pdf-site/$component/$version/_exports/index.pdf" + if [[ ! -s "$pdf" ]]; then + echo "::error::PDF export did not produce $pdf." + exit 1 + fi + echo "path=$pdf" >> "$GITHUB_OUTPUT" + echo "component_path=$component/$version" >> "$GITHUB_OUTPUT" - name: Checkout Web Repository (web) uses: actions/checkout@v4 @@ -126,6 +205,7 @@ jobs: token: ${{ secrets.WEB_TOKEN }} - name: Ensure web index redirects to latest home + if: matrix.target == 'html' id: update_web_index working-directory: ./www_publish_target env: @@ -163,100 +243,38 @@ jobs: echo "index_updated=${UPDATE_NEEDED}" >> "$GITHUB_OUTPUT" - - name: Setup Ruby and Bundler - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - - - name: Install Asciidoctor PDF and related Gems - run: | - echo "Installing Asciidoctor PDF gems..." - gem install asciidoctor-pdf --version "~>2.3.19" - gem install rouge - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '22.15' - - - name: Install Antora CLI - run: | - echo "Installing Antora packages local..." - npm install --global antora@3.1.7 @antora/lunr-extension @antora/pdf-extension@1.0.0-beta.20 @node-rs/jieba - - - name: Build English Documentation - working-directory: ./ivory-doc-builder - run: | - echo "Current directory: $(pwd)" - echo "Building English site..." - ls ../www_publish_target/ - npx antora generate --stacktrace --to-dir ../www_publish_target/docs/en antora-playbook-EN.yml - - - name: Copy English PDF export into web repo - working-directory: ./ivory-doc-builder - env: - MERGED_BRANCH: ${{ inputs.source_branch || github.ref_name }} - COMPONENT_NAME: ivorysql-doc - run: | - set -euo pipefail - - if [[ -z "${MERGED_BRANCH}" ]]; then - echo "::error::Merged branch name is empty, cannot locate PDF output." - exit 1 - fi - - SOURCE_PDF_EN="build/assembler-pdf/${COMPONENT_NAME}/${MERGED_BRANCH}/_exports/index.pdf" - DEST_EN="../www_publish_target/docs/en/${COMPONENT_NAME}/${MERGED_BRANCH}/ivorysql.pdf" - - if [[ ! -f "${SOURCE_PDF_EN}" ]]; then - echo "::error::English PDF not found at ${SOURCE_PDF_EN}" - exit 1 - fi - - echo "Copying English PDF from ${SOURCE_PDF_EN} to web repo target..." - mkdir -p "$(dirname "${DEST_EN}")" - cp "${SOURCE_PDF_EN}" "${DEST_EN}" - echo "English PDF copied to:" - echo " - ${DEST_EN}" - - - name: Build Chinese Documentation + - name: Build English and Chinese websites + if: matrix.target == 'html' working-directory: ./ivory-doc-builder + shell: bash run: | - echo "Building Chinese site..." - npx antora generate --stacktrace --to-dir ../www_publish_target/docs/cn antora-playbook-CN.yml + for language in en cn; do + yq ' + del(.antora.extensions[] | select(. == "@antora/pdf-extension" or .require == "@antora/pdf-extension")) | + .output.clean = false + ' "antora-playbook-${language^^}.yml" > "antora-playbook-html-${language}.yml" + npx antora generate --stacktrace --to-dir "../www_publish_target/docs/${language}" "antora-playbook-html-${language}.yml" + done - - name: Copy Chinese PDF export into web repo - working-directory: ./ivory-doc-builder + - name: Copy PDF into web repository + if: matrix.target != 'html' + working-directory: ./www_publish_target env: - MERGED_BRANCH: ${{ inputs.source_branch || github.ref_name }} - COMPONENT_NAME: ivorysql-doc + PDF_LANGUAGE: ${{ matrix.target }} + PDF: ${{ steps.pdf.outputs.path }} + COMPONENT_PATH: ${{ steps.pdf.outputs.component_path }} run: | - set -euo pipefail - - if [[ -z "${MERGED_BRANCH}" ]]; then - echo "::error::Merged branch name is empty, cannot locate PDF output." - exit 1 - fi - - SOURCE_PDF="build/assembler-pdf/${COMPONENT_NAME}/${MERGED_BRANCH}/_exports/index.pdf" - DEST_CN="../www_publish_target/docs/cn/${COMPONENT_NAME}/${MERGED_BRANCH}/ivorysql.pdf" - - if [[ ! -f "${SOURCE_PDF}" ]]; then - echo "::error::PDF not found at ${SOURCE_PDF}" - exit 1 - fi - - echo "Copying PDF from ${SOURCE_PDF} to web repo targets..." - mkdir -p "$(dirname "${DEST_CN}")" - cp "${SOURCE_PDF}" "${DEST_CN}" - echo "PDF copied to:" - echo " - ${DEST_CN}" + web_component="docs/$PDF_LANGUAGE/$COMPONENT_PATH" + mkdir -p "$web_component/_exports" + cp "$PDF" "$web_component/_exports/index.pdf" + cp "$PDF" "$web_component/ivorysql.pdf" - name: Commit and Push to web Repository new branch , pull request id: commit_push_new_branch working-directory: ./www_publish_target env: OPEN_PUSH_PR: true + TARGET: ${{ matrix.target }} run: | echo "push_pr=${OPEN_PUSH_PR}" >> $GITHUB_OUTPUT echo "--- Preparing to commit and push changes ---" @@ -273,20 +291,21 @@ jobs: echo "changes_detected=false" >> $GITHUB_OUTPUT else echo "Changes detected. Proceeding with add, commit, and push." + SOURCE_COMMIT="$(git -C ../ivorysql_doc rev-parse HEAD)" + echo "source_commit=$SOURCE_COMMIT" >> "$GITHUB_OUTPUT" + COMMIT_MESSAGE="docs: Regenerate documentation ($TARGET) from IvorySQL/ivorysql_docs commit $SOURCE_COMMIT" if [[ "${OPEN_PUSH_PR}" == "true" ]]; then - NEW_BRANCH_NAME="docs-update-${{ github.run_attempt }}-$(date +'%Y-%m-%d-%H%M%S')" + NEW_BRANCH_NAME="docs-update-${{ github.run_id }}-${{ github.run_attempt }}-$TARGET" echo "Generated new branch name: ${NEW_BRANCH_NAME}" echo "new_branch_name=${NEW_BRANCH_NAME}" >> $GITHUB_OUTPUT echo "changes_detected=true" >> $GITHUB_OUTPUT git checkout -b "${NEW_BRANCH_NAME}" git add . - COMMIT_MESSAGE="docs: Regenerate Antora site from IvorySQL/ivorysql_docs commit ${{ github.event.head_commit.id || github.sha }}" git commit -m "${COMMIT_MESSAGE}" git push origin "${NEW_BRANCH_NAME}" else echo "Pushing changes to master branch." git add . - COMMIT_MESSAGE="docs: Regenerate Antora site from IvorySQL/ivorysql_docs commit ${{ github.event.head_commit.id || github.sha }}" git commit -m "${COMMIT_MESSAGE}" git push origin master fi @@ -300,11 +319,11 @@ jobs: GH_TOKEN: ${{ secrets.WEB_TOKEN }} PARAM_BASE_BRANCH: master PARAM_HEAD_BRANCH: ${{ steps.commit_push_new_branch.outputs.new_branch_name }} - PARAM_TITLE: "Docs: Automated update from IvorySQL/ivorysql_docs commit ${{ github.event.head_commit.id || github.sha }}" + PARAM_TITLE: "Docs: Automated update (${{ matrix.target }}) from IvorySQL/ivorysql_docs" PARAM_BODY: | Automated Antora site regeneration based on changes in the IvorySQL/ivorysql_docs repository. - Source commit: `${{ github.server_url }}/${{ github.repository_owner }}/ivorysql_docs/commit/${{ github.event.head_commit.id || github.sha }}` + Source commit: `${{ github.server_url }}/${{ github.repository_owner }}/ivorysql_docs/commit/${{ steps.commit_push_new_branch.outputs.source_commit }}` - Auto-generated by gh pr create PARAM_DRAFT: "false" diff --git a/CN/modules/ROOT/pages/v6.0/pg_reference/pg_functions_reference.adoc b/CN/modules/ROOT/pages/v6.0/pg_reference/pg_functions_reference.adoc index aa21df0a..a4e76843 100644 --- a/CN/modules/ROOT/pages/v6.0/pg_reference/pg_functions_reference.adoc +++ b/CN/modules/ROOT/pages/v6.0/pg_reference/pg_functions_reference.adoc @@ -1060,8 +1060,9 @@ h| 函数名称 h| has_table_privilege | 参数数据类型 | user, table, privilege或者table, privilege | 函数返回值数据类型 | boolean | 函数含义 | 特定user是否对特定table有特定权限当前user是否对特定table有特定权限此处的权限是指如下的组合: SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER,还可以带有WITH GRANT OPTION用来测试privilege是否带有grant option。当权限字符串有多个值(比如'insert, select')时,只要有任何一个权限是满足的,本函数会返回t有关对权限字符串的说明:权限字符串不区分大小写权限字符串的前后可以有一个或者多个空格(权限名字内部不能有空格) -| 使用举例 -a| +|=== + +.使用举例 [source,sql] ---- postgres=# select has_table_privilege('t1',' select, insert '); @@ -1116,7 +1117,6 @@ cwbase3=> insert into test1 values(6); ERROR: permission denied for table test1 cwbase3=> ---- -|=== @@ -1818,43 +1818,44 @@ h| 函数名称 h| format_type | 参数数据类型 | type_oid, typemod | 函数返回值数据类型 | Text | 函数含义 | 得到一个data type的SQL Name -| 使用举例 -a| +|=== + +.使用举例 [source,sql] ---- postgres=# select * from pg_type where typname='bool'; -[ RECORD 1 ]--+--------- -oid \| 16 -typname \| bool -typnamespace \| 11 -typowner \| 10 -typlen \| 1 -typbyval \| t -typtype \| b -typcategory \| B -typispreferred \| t -typisdefined \| t -typdelim \| , -typrelid \| 0 -typelem \| 0 -typarray \| 1000 -typinput \| boolin -typoutput \| boolout -typreceive \| boolrecv -typsend \| boolsend -typmodin \| - -typmodout \| - -typanalyze \| - -typalign \| c -typstorage \| p -typnotnull \| f -typbasetype \| 0 -typtypmod \| -1 -typndims \| 0 -typcollation \| 0 -typdefaultbin \| -typdefault \| -typacl \| +oid | 16 +typname | bool +typnamespace | 11 +typowner | 10 +typlen | 1 +typbyval | t +typtype | b +typcategory | B +typispreferred | t +typisdefined | t +typdelim | , +typrelid | 0 +typelem | 0 +typarray | 1000 +typinput | boolin +typoutput | boolout +typreceive | boolrecv +typsend | boolsend +typmodin | - +typmodout | - +typanalyze | - +typalign | c +typstorage | p +typnotnull | f +typbasetype | 0 +typtypmod | -1 +typndims | 0 +typcollation | 0 +typdefaultbin | +typdefault | +typacl | postgres=# postgres=# select format_type(16,0); @@ -1866,8 +1867,6 @@ postgres=# select format_type(16,0); postgres=# ---- -|=== - === pg_get_constraintdef diff --git a/EN/modules/ROOT/pages/v6.0/oracle_compatibility/compat_create_type_as_object_en.adoc b/EN/modules/ROOT/pages/v6.0/oracle_compatibility/compat_create_type_as_object_en.adoc index 89d20edf..98f8895a 100644 --- a/EN/modules/ROOT/pages/v6.0/oracle_compatibility/compat_create_type_as_object_en.adoc +++ b/EN/modules/ROOT/pages/v6.0/oracle_compatibility/compat_create_type_as_object_en.adoc @@ -345,4 +345,4 @@ DROP TYPE counter_obj; DROP TABLE address_holder; DROP TABLE address_objects; DROP TYPE address_obj; - +```